Package com.viaversion.nbt.tag
Class ByteArrayTag
java.lang.Object
com.viaversion.nbt.tag.ByteArrayTag
- All Implemented Interfaces:
NumberArrayTag,Tag
A tag containing a byte array.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the raw string representation of the value of this tag.copy()Returns a copy of this tag.booleanbyteget(int index) Gets a value in this tag's array.intgetTagId()Returns the NBT tag id of this tag type, used in I/O.byte[]getValue()Returns the value of this tag.inthashCode()intlength()Gets the length of this tag's array.static ByteArrayTagread(DataInput in, TagLimiter tagLimiter) voidset(int index, byte value) Sets a value in this tag's array.voidsetValue(byte[] value) Sets the value of this tag.Creates a new list tag from this tag.toString()voidwrite(DataOutput out) Writes this tag to an output stream.
-
Field Details
-
ID
public static final int ID- See Also:
-
-
Constructor Details
-
ByteArrayTag
public ByteArrayTag()Creates a tag. -
ByteArrayTag
public ByteArrayTag(byte[] value) Creates a tag.- Parameters:
value- The value of the tag.
-
-
Method Details
-
read
- Throws:
IOException
-
getValue
public byte[] getValue()Description copied from interface:TagReturns the value of this tag. -
asRawString
Description copied from interface:TagReturns the raw string representation of the value of this tag. For SNBT, useSNBT.serialize(Tag).- Specified by:
asRawStringin interfaceTag- Returns:
- raw string representation of the value of this tag
-
setValue
public void setValue(byte[] value) Sets the value of this tag.- Parameters:
value- New value of this tag.
-
get
public byte get(int index) Gets a value in this tag's array.- Parameters:
index- Index of the value.- Returns:
- The value at the given index.
-
set
public void set(int index, byte value) Sets a value in this tag's array.- Parameters:
index- Index of the value.value- Value to set.
-
length
public int length()Description copied from interface:NumberArrayTagGets the length of this tag's array.- Specified by:
lengthin interfaceNumberArrayTag- Returns:
- array length
-
toListTag
Description copied from interface:NumberArrayTagCreates a new list tag from this tag.- Specified by:
toListTagin interfaceNumberArrayTag- Returns:
- a new list tag
-
write
Description copied from interface:TagWrites this tag to an output stream.- Specified by:
writein interfaceTag- Parameters:
out- data output to write to- Throws:
IOException- if an I/O error occurs
-
equals
-
hashCode
public int hashCode() -
copy
Description copied from interface:TagReturns a copy of this tag.- Specified by:
copyin interfaceNumberArrayTag- Specified by:
copyin interfaceTag- Returns:
- a copy of this tag
-
getTagId
public int getTagId()Description copied from interface:TagReturns the NBT tag id of this tag type, used in I/O. -
toString
-