package com.evilco.mc.nbt.tag;

import com.evilco.mc.nbt.stream.NbtInputStream;
import com.evilco.mc.nbt.stream.NbtOutputStream;
import java.io.IOException;
import javax.annotation.Nonnull;

public class TagLong extends AbstractTag {
   protected long value;

   public TagLong(@Nonnull String name, long value) {
      super(name);
      this.setValue(value);
   }

   public TagLong(@Nonnull NbtInputStream inputStream, boolean anonymous) throws IOException {
      super(inputStream, anonymous);
      this.setValue(inputStream.readLong());
   }

   public byte getTagID() {
      return TagType.LONG.typeID;
   }

   public long getValue() {
      return this.value;
   }

   public void setValue(long l) {
      this.value = l;
   }

   public void write(NbtOutputStream outputStream, boolean anonymous) throws IOException {
      super.write(outputStream, anonymous);
      outputStream.writeLong(this.value);
   }
}
