Class BinaryTagIO

java.lang.Object
net.kyori.adventure.nbt.BinaryTagIO

public final class BinaryTagIO
extends Object
Serialization operations for binary tags.
Since:
4.0.0
  • Method Details

    • readPath

      public static @NonNull CompoundBinaryTag readPath​(@NonNull Path path) throws IOException
      Reads a compound tag from path.
      Parameters:
      path - the path
      Returns:
      the compound tag
      Throws:
      IOException - if an exception was encountered while reading a compound tag
      Since:
      4.0.0
    • readInputStream

      public static @NonNull CompoundBinaryTag readInputStream​(@NonNull InputStream input) throws IOException
      Reads a compound tag from an input stream. The stream is not closed afterwards.
      Parameters:
      input - the input stream
      Returns:
      the compound tag
      Throws:
      IOException - if an exception was encountered while reading a compound tag
      Since:
      4.0.0
    • readCompressedPath

      public static @NonNull CompoundBinaryTag readCompressedPath​(@NonNull Path path) throws IOException
      Reads a compound tag from path using GZIP decompression.
      Parameters:
      path - the path
      Returns:
      the compound tag
      Throws:
      IOException - if an exception was encountered while reading a compound tag
      Since:
      4.0.0
    • readCompressedInputStream

      public static @NonNull CompoundBinaryTag readCompressedInputStream​(@NonNull InputStream input) throws IOException
      Reads a compound tag from an input stream using GZIP decompression. The stream is not closed afterwards.
      Parameters:
      input - the input stream
      Returns:
      the compound tag
      Throws:
      IOException - if an exception was encountered while reading a compound tag
      Since:
      4.0.0
    • readDataInput

      public static @NonNull CompoundBinaryTag readDataInput​(@NonNull DataInput input) throws IOException
      Reads a compound tag from input.
      Parameters:
      input - the input
      Returns:
      the compound tag
      Throws:
      IOException - if an exception was encountered while reading a compound tag
      Since:
      4.0.0
    • writePath

      public static void writePath​(@NonNull CompoundBinaryTag tag, @NonNull Path path) throws IOException
      Writes a compound tag to path.
      Parameters:
      tag - the compound tag
      path - the path
      Throws:
      IOException - if an exception was encountered while writing the compound tag
      Since:
      4.0.0
    • writeOutputStream

      public static void writeOutputStream​(@NonNull CompoundBinaryTag tag, @NonNull OutputStream output) throws IOException
      Writes a compound tag to an output stream. The output stream will not be closed.
      Parameters:
      tag - the compound tag
      output - the output stream
      Throws:
      IOException - if an exception was encountered while writing the compound tag
      Since:
      4.0.0
    • writeCompressedPath

      public static void writeCompressedPath​(@NonNull CompoundBinaryTag tag, @NonNull Path path) throws IOException
      Writes a compound tag to path using GZIP compression.
      Parameters:
      tag - the compound tag
      path - the path
      Throws:
      IOException - if an exception was encountered while writing the compound tag
      Since:
      4.0.0
    • writeCompressedOutputStream

      public static void writeCompressedOutputStream​(@NonNull CompoundBinaryTag tag, @NonNull OutputStream output) throws IOException
      Writes a compound tag to an output stream using GZIP compression. The output stream is not closed afterwards.
      Parameters:
      tag - the compound tag
      output - the output stream
      Throws:
      IOException - if an exception was encountered while writing the compound tag
      Since:
      4.0.0
    • writeDataOutput

      public static void writeDataOutput​(@NonNull CompoundBinaryTag tag, @NonNull DataOutput output) throws IOException
      Writes a compound tag to output.
      Parameters:
      tag - the compound tag
      output - the output
      Throws:
      IOException - if an exception was encountered while writing the compound tag
      Since:
      4.0.0