-
- All Implemented Interfaces:
public class NbtIO
Contains useful methods do read and write NbtFile from File and InputStream/OutputStream.
-
-
Method Summary
Modifier and Type Method Description final static Unit
writeNbtFileAsOriginal(OutputStream outputStream, NbtFile file)
Calls writeNbtFile using the information stored in the NbtFile, uses the method's default when the information is missing (null). final static Unit
writeNbtFile(OutputStream outputStream, NbtFile file, Boolean compressed, Boolean littleEndian)
Writes the NbtFile in the stream. final static Unit
writeNbtFile(OutputStream outputStream, NbtFile file, Boolean compressed)
Writes the NbtFile in the stream. final static Unit
writeNbtFile(OutputStream outputStream, NbtFile file)
Writes the NbtFile in the stream. final static Unit
writeNbtFile(File file, NbtFile tag, Boolean compressed, Boolean littleEndian, Boolean writeHeaders)
Writes the NbtFile in a File. final static Unit
writeNbtFile(File file, NbtFile tag, Boolean compressed, Boolean littleEndian)
Writes the NbtFile in a File. final static Unit
writeNbtFile(File file, NbtFile tag, Boolean compressed)
Writes the NbtFile in a File. final static Unit
writeNbtFile(File file, NbtFile tag)
Writes the NbtFile in a File. final static Unit
writeNbtFileDirectly(DataOutput output, NbtFile file)
Writes the NbtFile to the output. final static NbtFile
readNbtFile(InputStream inputStream, Boolean compressed, Boolean littleEndian, Boolean readHeaders)
Read a NbtFile from the InputStream. final static NbtFile
readNbtFile(InputStream inputStream, Boolean compressed, Boolean littleEndian)
Read a NbtFile from the InputStream. final static NbtFile
readNbtFile(InputStream inputStream, Boolean compressed)
Read a NbtFile from the InputStream. final static NbtFile
readNbtFile(InputStream inputStream)
Read a NbtFile from the InputStream. final static NbtFile
readNbtFile(File file, Boolean compressed, Boolean littleEndian, Boolean readHeaders)
Read a NbtFile from a File. final static NbtFile
readNbtFile(File file, Boolean compressed, Boolean littleEndian)
Read a NbtFile from a File. final static NbtFile
readNbtFile(File file, Boolean compressed)
Read a NbtFile from a File. final static NbtFile
readNbtFile(File file)
Read a NbtFile from a File. final static NbtFile
readNbtFileDirectly(DataInput input)
Reads a NbtFile from the input. final static NbtFile
readNbtFileDetectingSettings(File file)
Does an exhaustive attempts to load the NBT file, returning it if any of the attempts is successful. final static Unit
writeNbtTagDirectly(DataOutput output, NbtTag tag, Boolean writeTypeId)
Writes the NbtTag directly, without name and optionally without type id. final static <T extends NbtTag> T
readNbtTagDirectly(DataInput input, Class<T> tagType)
Reads a NbtTag of type T from the input directly, this is a reader for writeNbtTagDirectly. final static <T extends NbtTag> T
readNbtTagDirectly(DataInput input)
Reads a NbtTag of type T from the input directly, this is a reader for writeNbtTagDirectly. -
-
Method Detail
-
writeNbtFileAsOriginal
final static Unit writeNbtFileAsOriginal(OutputStream outputStream, NbtFile file)
Calls writeNbtFile using the information stored in the NbtFile, uses the method's default when the information is missing (null). This method does not write the Bedrock Edition version and length headers.
- Parameters:
outputStream
- The stream that the file will be writtenfile
- The file that will be written to the stream
-
writeNbtFile
final static Unit writeNbtFile(OutputStream outputStream, NbtFile file, Boolean compressed, Boolean littleEndian)
Writes the NbtFile in the stream. This method does not write the Bedrock Edition version and length headers.
- Parameters:
outputStream
- The stream that the file will be writtenfile
- The file that will be written to the streamcompressed
- If the file will be compressed by GZIPOutputStream.littleEndian
- Uses little endian to write to the stream as in Bedrock Edition
-
writeNbtFile
final static Unit writeNbtFile(OutputStream outputStream, NbtFile file, Boolean compressed)
Writes the NbtFile in the stream. This method does not write the Bedrock Edition version and length headers.
- Parameters:
outputStream
- The stream that the file will be writtenfile
- The file that will be written to the streamcompressed
- If the file will be compressed by GZIPOutputStream.
-
writeNbtFile
final static Unit writeNbtFile(OutputStream outputStream, NbtFile file)
Writes the NbtFile in the stream. This method does not write the Bedrock Edition version and length headers.
- Parameters:
outputStream
- The stream that the file will be writtenfile
- The file that will be written to the stream
-
writeNbtFile
final static Unit writeNbtFile(File file, NbtFile tag, Boolean compressed, Boolean littleEndian, Boolean writeHeaders)
- Parameters:
file
- The output filecompressed
- If the file will be compressed by GZIPOutputStreamlittleEndian
- Uses little endian to write to the stream as in Bedrock EditionwriteHeaders
- Writes the NbtFile.version and content size headers to the file.
-
writeNbtFile
final static Unit writeNbtFile(File file, NbtFile tag, Boolean compressed, Boolean littleEndian)
- Parameters:
file
- The output filecompressed
- If the file will be compressed by GZIPOutputStreamlittleEndian
- Uses little endian to write to the stream as in Bedrock Edition
-
writeNbtFile
final static Unit writeNbtFile(File file, NbtFile tag, Boolean compressed)
- Parameters:
file
- The output filecompressed
- If the file will be compressed by GZIPOutputStream
-
writeNbtFile
final static Unit writeNbtFile(File file, NbtFile tag)
- Parameters:
file
- The output file
-
writeNbtFileDirectly
final static Unit writeNbtFileDirectly(DataOutput output, NbtFile file)
Writes the NbtFile to the output. This method does not write the Bedrock Edition version and length headers.
- Parameters:
output
- Where the file will be written, needs to handle compression and endianness.file
- The file that will be written to the output
-
readNbtFile
final static NbtFile readNbtFile(InputStream inputStream, Boolean compressed, Boolean littleEndian, Boolean readHeaders)
Read a NbtFile from the InputStream.
- Parameters:
inputStream
- The input stream that will be readcompressed
- If the file needs to be decompressed by GZIPInputStreamlittleEndian
- Reads the NBT file using little endian byte orderreadHeaders
- Reads the NBT version and length headers before the content These data are read in little endian byte order regardless of the littleEndian parameter.
-
readNbtFile
final static NbtFile readNbtFile(InputStream inputStream, Boolean compressed, Boolean littleEndian)
Read a NbtFile from the InputStream.
- Parameters:
inputStream
- The input stream that will be readcompressed
- If the file needs to be decompressed by GZIPInputStreamlittleEndian
- Reads the NBT file using little endian byte order
-
readNbtFile
final static NbtFile readNbtFile(InputStream inputStream, Boolean compressed)
Read a NbtFile from the InputStream.
- Parameters:
inputStream
- The input stream that will be readcompressed
- If the file needs to be decompressed by GZIPInputStream
-
readNbtFile
final static NbtFile readNbtFile(InputStream inputStream)
Read a NbtFile from the InputStream.
- Parameters:
inputStream
- The input stream that will be read
-
readNbtFile
final static NbtFile readNbtFile(File file, Boolean compressed, Boolean littleEndian, Boolean readHeaders)
- Parameters:
file
- The input file that will be readcompressed
- If the file needs to be decompressed by GZIPInputStream
-
readNbtFile
final static NbtFile readNbtFile(File file, Boolean compressed, Boolean littleEndian)
- Parameters:
file
- The input file that will be readcompressed
- If the file needs to be decompressed by GZIPInputStream
-
readNbtFile
final static NbtFile readNbtFile(File file, Boolean compressed)
- Parameters:
file
- The input file that will be readcompressed
- If the file needs to be decompressed by GZIPInputStream
-
readNbtFile
final static NbtFile readNbtFile(File file)
- Parameters:
file
- The input file that will be read
-
readNbtFileDirectly
final static NbtFile readNbtFileDirectly(DataInput input)
Reads a NbtFile from the input. This method does not read the Bedrock Edition version and length headers.
- Parameters:
input
- Where the file will be read, needs to handle compression and endianness.
-
readNbtFileDetectingSettings
final static NbtFile readNbtFileDetectingSettings(File file)
Does an exhaustive attempts to load the NBT file, returning it if any of the attempts is successful.
-
writeNbtTagDirectly
final static Unit writeNbtTagDirectly(DataOutput output, NbtTag tag, Boolean writeTypeId)
Writes the NbtTag directly, without name and optionally without type id.
- Parameters:
output
- Where the file will be written, needs to handle compression and endianness.tag
- The tag that will be written to the outputwriteTypeId
- If the first byte written should be the NBT tag type id.
-
readNbtTagDirectly
final static <T extends NbtTag> T readNbtTagDirectly(DataInput input, Class<T> tagType)
Reads a NbtTag of type T from the input directly, this is a reader for writeNbtTagDirectly.
- Parameters:
input
- Where the file will be read, needs to handle compression and endianness.tagType
- The type of the tag that will be read, usenull
if the tag was written withwriteTypeId
enabled
-
readNbtTagDirectly
final static <T extends NbtTag> T readNbtTagDirectly(DataInput input)
Reads a NbtTag of type T from the input directly, this is a reader for writeNbtTagDirectly.
- Parameters:
input
- Where the file will be read, needs to handle compression and endianness.
-
-
-
-