Package net.kyori.adventure.nbt
Class TagStringIO
- java.lang.Object
-
- net.kyori.adventure.nbt.TagStringIO
-
public final class TagStringIO extends Object
A holder for string tag format options.- Since:
- 4.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TagStringIO.Builder
Builder for a SNBT I/O handler.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CompoundBinaryTag
asCompound(String input)
Read the string into a compound tag structure.String
asString(CompoundBinaryTag input)
Get a string representation of the provided tag.static @NotNull TagStringIO.Builder
builder()
Create an new builder to configure IO.static @NotNull TagStringIO
get()
Get an instance ofTagStringIO
that creates reads and writes using standard options.void
toWriter(CompoundBinaryTag input, Writer dest)
Writes a tag to in string format.
-
-
-
Method Detail
-
get
@NotNull public static @NotNull TagStringIO get()
Get an instance ofTagStringIO
that creates reads and writes using standard options.- Returns:
- the basic instance
- Since:
- 4.0.0
-
builder
@NotNull public static @NotNull TagStringIO.Builder builder()
Create an new builder to configure IO.- Returns:
- a builder
- Since:
- 4.0.0
-
asCompound
public CompoundBinaryTag asCompound(String input) throws IOException
Read the string into a compound tag structure.When working with untrusted input (such as from the network), users should be careful to validate that the
input
string is of a reasonable size.- Parameters:
input
- Input data- Returns:
- this
- Throws:
IOException
- on any syntax errors- Since:
- 4.0.0
-
asString
public String asString(CompoundBinaryTag input) throws IOException
Get a string representation of the provided tag.- Parameters:
input
- tag to serialize- Returns:
- serialized form
- Throws:
IOException
- if any errors occur writing to string- Since:
- 4.0.0
-
toWriter
public void toWriter(CompoundBinaryTag input, Writer dest) throws IOException
Writes a tag to in string format.The provided
Writer
will remain open after reading a tag.- Parameters:
input
- Tag to writedest
- Writer to write to- Throws:
IOException
- if any IO or syntax errors occur while parsing- Since:
- 4.0.0
-
-