Class TagStringIO


  • public final class TagStringIO
    extends Object
    A holder for string tag format options.
    Since:
    4.0.0
    • Method Detail

      • get

        @NotNull
        public static @NotNull TagStringIO get()
        Get an instance of TagStringIO 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 write
        dest - Writer to write to
        Throws:
        IOException - if any IO or syntax errors occur while parsing
        Since:
        4.0.0