Package net.kyori.adventure.nbt
Class BinaryTagIO
- java.lang.Object
-
- net.kyori.adventure.nbt.BinaryTagIO
-
public final class BinaryTagIO extends java.lang.Object
Serialization operations for binary tags.- Since:
- 4.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BinaryTagIO.Compression
Compression types.static interface
BinaryTagIO.Reader
CompoundBinaryTag
reader.static interface
BinaryTagIO.Writer
CompoundBinaryTag
writer.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static @NotNull CompoundBinaryTag
readCompressedInputStream(@NotNull java.io.InputStream input)
Deprecated.since 4.4.0, usereader()
static @NotNull CompoundBinaryTag
readCompressedPath(@NotNull java.nio.file.Path path)
Deprecated.since 4.4.0, usereader()
static @NotNull CompoundBinaryTag
readDataInput(@NotNull java.io.DataInput input)
Deprecated.since 4.4.0, usereader()
static @NotNull BinaryTagIO.Reader
reader()
ReturnsBinaryTagIO.Reader
, used to read binary tags.static @NotNull BinaryTagIO.Reader
reader(long sizeLimitBytes)
ReturnsBinaryTagIO.Reader
, used to read binary tags.static @NotNull CompoundBinaryTag
readInputStream(@NotNull java.io.InputStream input)
Deprecated.since 4.4.0, usereader()
static @NotNull CompoundBinaryTag
readPath(@NotNull java.nio.file.Path path)
Deprecated.since 4.4.0, usereader()
static @NotNull BinaryTagIO.Reader
unlimitedReader()
ReturnsBinaryTagIO.Reader
, used to read binary tags.static void
writeCompressedOutputStream(@NotNull CompoundBinaryTag tag, @NotNull java.io.OutputStream output)
Deprecated.since 4.4.0, usewriter()
static void
writeCompressedPath(@NotNull CompoundBinaryTag tag, @NotNull java.nio.file.Path path)
Deprecated.since 4.4.0, usewriter()
static void
writeDataOutput(@NotNull CompoundBinaryTag tag, @NotNull java.io.DataOutput output)
Deprecated.since 4.4.0, usewriter()
static void
writeOutputStream(@NotNull CompoundBinaryTag tag, @NotNull java.io.OutputStream output)
Deprecated.since 4.4.0, usewriter()
static void
writePath(@NotNull CompoundBinaryTag tag, @NotNull java.nio.file.Path path)
Deprecated.since 4.4.0, usewriter()
static @NotNull BinaryTagIO.Writer
writer()
ReturnsBinaryTagIO.Writer
, used to write binary tags.
-
-
-
Method Detail
-
unlimitedReader
@NotNull public static @NotNull BinaryTagIO.Reader unlimitedReader()
ReturnsBinaryTagIO.Reader
, used to read binary tags.There is a maximum depth of
512
nested tags allowed, but no limit for the amount of contained data.- Returns:
- binary tag reader
- Since:
- 4.4.0
-
reader
@NotNull public static @NotNull BinaryTagIO.Reader reader()
ReturnsBinaryTagIO.Reader
, used to read binary tags.This reader has a size limit for the estimated number of data bytes for a tag.
- Returns:
- binary tag reader
- Since:
- 4.4.0
-
reader
@NotNull public static @NotNull BinaryTagIO.Reader reader(long sizeLimitBytes)
ReturnsBinaryTagIO.Reader
, used to read binary tags.This reader will limit the number of bytes read to the approximate size limit indicated.
- Parameters:
sizeLimitBytes
- the maximum (approximate) size of uncompressed data, must be greater than0
- Returns:
- binary tag reader
- Since:
- 4.4.0
-
writer
@NotNull public static @NotNull BinaryTagIO.Writer writer()
ReturnsBinaryTagIO.Writer
, used to write binary tags.- Returns:
- binary tag writer
- Since:
- 4.4.0
-
readPath
@Deprecated @NotNull public static @NotNull CompoundBinaryTag readPath(@NotNull @NotNull java.nio.file.Path path) throws java.io.IOException
Deprecated.since 4.4.0, usereader()
Reads a compound tag frompath
.- Parameters:
path
- the path- Returns:
- the compound tag
- Throws:
java.io.IOException
- if an exception was encountered while reading a compound tag- Since:
- 4.0.0
-
readInputStream
@Deprecated @NotNull public static @NotNull CompoundBinaryTag readInputStream(@NotNull @NotNull java.io.InputStream input) throws java.io.IOException
Deprecated.since 4.4.0, usereader()
Reads a compound tag from an input stream. The stream is not closed afterwards.- Parameters:
input
- the input stream- Returns:
- the compound tag
- Throws:
java.io.IOException
- if an exception was encountered while reading a compound tag- Since:
- 4.0.0
-
readCompressedPath
@Deprecated @NotNull public static @NotNull CompoundBinaryTag readCompressedPath(@NotNull @NotNull java.nio.file.Path path) throws java.io.IOException
Deprecated.since 4.4.0, usereader()
Reads a compound tag frompath
using GZIP decompression.- Parameters:
path
- the path- Returns:
- the compound tag
- Throws:
java.io.IOException
- if an exception was encountered while reading a compound tag- Since:
- 4.0.0
-
readCompressedInputStream
@Deprecated @NotNull public static @NotNull CompoundBinaryTag readCompressedInputStream(@NotNull @NotNull java.io.InputStream input) throws java.io.IOException
Deprecated.since 4.4.0, usereader()
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:
java.io.IOException
- if an exception was encountered while reading a compound tag- Since:
- 4.0.0
-
readDataInput
@Deprecated @NotNull public static @NotNull CompoundBinaryTag readDataInput(@NotNull @NotNull java.io.DataInput input) throws java.io.IOException
Deprecated.since 4.4.0, usereader()
Reads a compound tag frominput
.- Parameters:
input
- the input- Returns:
- the compound tag
- Throws:
java.io.IOException
- if an exception was encountered while reading a compound tag- Since:
- 4.0.0
-
writePath
@Deprecated public static void writePath(@NotNull @NotNull CompoundBinaryTag tag, @NotNull @NotNull java.nio.file.Path path) throws java.io.IOException
Deprecated.since 4.4.0, usewriter()
Writes a compound tag topath
.- Parameters:
tag
- the compound tagpath
- the path- Throws:
java.io.IOException
- if an exception was encountered while writing the compound tag- Since:
- 4.0.0
-
writeOutputStream
@Deprecated public static void writeOutputStream(@NotNull @NotNull CompoundBinaryTag tag, @NotNull @NotNull java.io.OutputStream output) throws java.io.IOException
Deprecated.since 4.4.0, usewriter()
Writes a compound tag to an output stream. The output stream will not be closed.- Parameters:
tag
- the compound tagoutput
- the output stream- Throws:
java.io.IOException
- if an exception was encountered while writing the compound tag- Since:
- 4.0.0
-
writeCompressedPath
@Deprecated public static void writeCompressedPath(@NotNull @NotNull CompoundBinaryTag tag, @NotNull @NotNull java.nio.file.Path path) throws java.io.IOException
Deprecated.since 4.4.0, usewriter()
Writes a compound tag topath
using GZIP compression.- Parameters:
tag
- the compound tagpath
- the path- Throws:
java.io.IOException
- if an exception was encountered while writing the compound tag- Since:
- 4.0.0
-
writeCompressedOutputStream
@Deprecated public static void writeCompressedOutputStream(@NotNull @NotNull CompoundBinaryTag tag, @NotNull @NotNull java.io.OutputStream output) throws java.io.IOException
Deprecated.since 4.4.0, usewriter()
Writes a compound tag to an output stream using GZIP compression. The output stream is not closed afterwards.- Parameters:
tag
- the compound tagoutput
- the output stream- Throws:
java.io.IOException
- if an exception was encountered while writing the compound tag- Since:
- 4.0.0
-
writeDataOutput
@Deprecated public static void writeDataOutput(@NotNull @NotNull CompoundBinaryTag tag, @NotNull @NotNull java.io.DataOutput output) throws java.io.IOException
Deprecated.since 4.4.0, usewriter()
Writes a compound tag tooutput
.- Parameters:
tag
- the compound tagoutput
- the output- Throws:
java.io.IOException
- if an exception was encountered while writing the compound tag- Since:
- 4.0.0
-
-