Class NbtTextSerializer
java.lang.Object
com.comphenix.protocol.wrappers.nbt.io.NbtTextSerializer
Serializes NBT to a base-64 encoded string and back.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final NbtTextSerializerA default instance of this serializer. -
Constructor Summary
ConstructorsConstructorDescriptionNbtTextSerializer(NbtBinarySerializer binary) Construct a serializer with a custom binary serializer. -
Method Summary
Modifier and TypeMethodDescription<TType> NbtWrapper<TType> deserialize(String input) Deserialize a NBT tag from a base-64 encoded string.deserializeCompound(String input) Deserialize a NBT compound from a base-64 encoded string.<T> NbtList<T> deserializeList(String input) Deserialize a NBT list from a base-64 encoded string.Retrieve the binary serializer that is used.<TType> StringSerialize a NBT tag to a base-64 encoded string.
-
Field Details
-
DEFAULT
A default instance of this serializer.
-
-
Constructor Details
-
NbtTextSerializer
public NbtTextSerializer() -
NbtTextSerializer
Construct a serializer with a custom binary serializer.- Parameters:
binary- - binary serializer.
-
-
Method Details
-
getBinarySerializer
Retrieve the binary serializer that is used.- Returns:
- The binary serializer.
-
serialize
Serialize a NBT tag to a base-64 encoded string.- Type Parameters:
TType- Type- Parameters:
value- - the NBT tag to serialize.- Returns:
- The NBT tag in base-64 form.
-
deserialize
Deserialize a NBT tag from a base-64 encoded string.- Type Parameters:
TType- Type- Parameters:
input- - the base-64 string.- Returns:
- The NBT tag contained in the string.
- Throws:
IOException- If we are unable to parse the input.
-
deserializeCompound
Deserialize a NBT compound from a base-64 encoded string.- Parameters:
input- - the base-64 string.- Returns:
- The NBT tag contained in the string.
- Throws:
IOException- If we are unable to parse the input.
-
deserializeList
Deserialize a NBT list from a base-64 encoded string.- Type Parameters:
T- Type- Parameters:
input- - the base-64 string.- Returns:
- The NBT tag contained in the string.
- Throws:
IOException- If we are unable to parse the input.
-