public abstract class NBTTag extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
NBTTag.NBTTagType |
| Constructor and Description |
|---|
NBTTag() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
_print(PrintStream stream,
String indent) |
protected abstract void |
_read(io.netty.buffer.ByteBuf buf,
ByteOrder order) |
protected abstract void |
_write(io.netty.buffer.ByteBuf buf,
ByteOrder order) |
byte[] |
getAsByteArray()
Attempts to get this tag as a byte array.
|
ByteArrayTag |
getAsByteArrayTag()
Attempts to get this tag as a ByteArrayTag.
|
CompoundTag |
getAsCompoundTag()
Attempts to get this tag as a compound tag.
|
int[] |
getAsIntArray()
Attempts to get this tag as an int array.
|
IntArrayTag |
getAsIntArrayTag()
Attempts to get this tag as a IntArrayTag.
|
ListTag |
getAsListTag()
Attempts to get this tag as a list tag.
|
Number |
getAsNumber()
Attempts to get this tag as a Number.
|
NumberTag |
getAsNumberTag()
Attempts to get this tag as a NumberTag.
|
String |
getAsString()
Attempts to get this tag as a string.
|
StringTag |
getAsStringTag()
Attempts to get this tag as a StringTag.
|
Optional<String> |
getName()
Gets this tag's name.
|
byte |
getTypeId()
Gets this tag's type ID.
|
protected String |
indent(String indent) |
boolean |
isByteArray()
Checks whether or not this tag represents a byte array.
|
boolean |
isCompoundTag()
Checks whether or not this tag represents a compound tag.
|
boolean |
isIntArray()
Checks whether or not this tag represents an int array.
|
boolean |
isListTag()
Checks whether or not this tag represents a list tag.
|
boolean |
isNumber()
Checks whether or not this tag represents a number.
|
boolean |
isString()
Checks whether or not this tag represents a String.
|
protected String |
name() |
void |
print(PrintStream stream)
Prints this tag to the given print stream.
|
<T extends NBTTag> |
read(io.netty.buffer.ByteBuf buf,
ByteOrder order)
Reads data into this tag from the given buffer with the given byte order.
|
static String |
readString(io.netty.buffer.ByteBuf buf,
ByteOrder order)
Reads a string.
|
protected void |
setHasName(boolean hasName) |
<T extends NBTTag> |
setName(String name)
Sets this tag's name.
|
protected void |
setWriteType(boolean writeType) |
String |
toString() |
<T extends NBTTag> |
write(io.netty.buffer.ByteBuf buf,
ByteOrder order)
Writes data from this tag into the given buffer with the given byte order.
|
static void |
writeString(io.netty.buffer.ByteBuf buf,
ByteOrder order,
String string)
Writes a string.
|
public final byte getTypeId()
public final <T extends NBTTag> T setName(String name)
T - The type of NBT tag.name - The name.public final <T extends NBTTag> T read(io.netty.buffer.ByteBuf buf, ByteOrder order)
T - The type of NBT tag.buf - The buffer to read from.public final <T extends NBTTag> T write(io.netty.buffer.ByteBuf buf, ByteOrder order)
T - The type of NBT tag.buf - The buffer to write to.public final void print(PrintStream stream)
stream - The stream to print to.public boolean isNumber()
public Number getAsNumber()
public NumberTag getAsNumberTag()
public boolean isString()
public String getAsString()
public StringTag getAsStringTag()
public boolean isByteArray()
public byte[] getAsByteArray()
public ByteArrayTag getAsByteArrayTag()
public boolean isIntArray()
public int[] getAsIntArray()
public IntArrayTag getAsIntArrayTag()
public boolean isListTag()
public ListTag getAsListTag()
public boolean isCompoundTag()
public CompoundTag getAsCompoundTag()
protected abstract void _print(PrintStream stream, String indent)
protected abstract void _read(io.netty.buffer.ByteBuf buf,
ByteOrder order)
protected abstract void _write(io.netty.buffer.ByteBuf buf,
ByteOrder order)
public static String readString(io.netty.buffer.ByteBuf buf, ByteOrder order)
buf - The buffer to read from.public static void writeString(io.netty.buffer.ByteBuf buf,
ByteOrder order,
String string)
buf - The buffer to write to.string - The string.protected void setHasName(boolean hasName)
protected void setWriteType(boolean writeType)
protected String name()
Copyright © 2017. All rights reserved.