Package net.kyori.adventure.nbt
Class TagStringIO
java.lang.Object
net.kyori.adventure.nbt.TagStringIO
A holder for string tag format options.
- Since:
- 4.0.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for a SNBT I/O handler. -
Method Summary
Modifier and TypeMethodDescription@NotNull CompoundBinaryTagasCompound(@NotNull String input) Read the string into a compound tag structure.@NotNull CompoundBinaryTagasCompound(@NotNull String input, @NotNull Appendable remainder) Read the string into an embedded compound tag, returning the remainder of the input.@NotNull StringGet a string representation of the provided tag.@NotNull StringasString(@NotNull CompoundBinaryTag input) Get a string representation of the provided tag.@NotNull BinaryTagRead the string into a tag.@NotNull BinaryTagasTag(@NotNull String input, @NotNull Appendable remainder) Read the string into an embedded tag, returning the remainder of the input.static @NotNull TagStringIO.Builderbuilder()Create a new builder to configure IO.static @NotNull TagStringIOget()Deprecated.static @NotNull TagStringIOGets an instance ofTagStringIOthat reads and writes using standard options.voidWrites a tag to in string format.voidtoWriter(@NotNull CompoundBinaryTag input, @NotNull Writer dest) Writes a compound tag to in string format.
-
Method Details
-
get
Deprecated.For removal since 4.22.0, usetagStringIO()insteadGet an instance ofTagStringIOthat reads and writes using standard options.- Returns:
- the basic instance
- Since:
- 4.0.0
-
tagStringIO
Gets an instance ofTagStringIOthat reads and writes using standard options.- Returns:
- the basic instance
- Since:
- 4.22.0
-
builder
Create a new builder to configure IO.- Returns:
- a builder
- Since:
- 4.0.0
-
asCompound
@NotNull public @NotNull CompoundBinaryTag asCompound(@NotNull @NotNull 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
inputstring is of a reasonable size.- Parameters:
input- Input data- Returns:
- this
- Throws:
IOException- on any syntax errors- Since:
- 4.0.0
-
asTag
Read the string into a tag.When working with untrusted input (such as from the network), users should be careful to validate that the
inputstring is of a reasonable size.- Parameters:
input- Input data- Returns:
- the parsed tag
- Throws:
IOException- on any syntax errors- Since:
- 4.22.0
-
asCompound
@NotNull public @NotNull CompoundBinaryTag asCompound(@NotNull @NotNull String input, @NotNull @NotNull Appendable remainder) throws IOException Read the string into an embedded compound tag, returning the remainder of the input.- Parameters:
input- the input stringremainder- the appendable to write the remainder to- Returns:
- the parsed tag with the remainder
- Throws:
IOException- on any syntax errors- Since:
- 4.22.0
-
asTag
@NotNull public @NotNull BinaryTag asTag(@NotNull @NotNull String input, @NotNull @NotNull Appendable remainder) throws IOException Read the string into an embedded tag, returning the remainder of the input.- Parameters:
input- the input stringremainder- the appendable to write the remainder to- Returns:
- the parsed tag with the remainder
- Throws:
IOException- on any syntax errors- Since:
- 4.22.0
-
asString
@NotNull public @NotNull String asString(@NotNull @NotNull 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
-
asString
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.20.0
-
toWriter
public void toWriter(@NotNull @NotNull CompoundBinaryTag input, @NotNull @NotNull Writer dest) throws IOException Writes a compound tag to in string format.The provided
Writerwill 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
-
toWriter
public void toWriter(@NotNull @NotNull BinaryTag input, @NotNull @NotNull Writer dest) throws IOException Writes a tag to in string format.The provided
Writerwill 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.22.0
-
tagStringIO()instead