NBT-Manipulator

A kotlin/java lib that allows you to read and write NBT data in a clean way

View on GitHub

//nbt-manipulator/br.com.gamemods.nbtmanipulator/NbtIO/writeNbtFile

writeNbtFile

[jvm]\

@JvmStatic

@JvmOverloads

fun writeNbtFile(outputStream: OutputStream, file: NbtFile, compressed: Boolean = true, littleEndian: Boolean = false)

Writes the NbtFile in the stream. This method does not write the Bedrock Edition version and length headers.

Parameters

jvm

   
outputStream The stream that the file will be written
file The file that will be written to the stream
compressed If the file will be compressed by GZIPOutputStream.
littleEndian Uses little endian to write to the stream as in Bedrock Edition

[jvm]\

@JvmStatic

@JvmOverloads

fun writeNbtFile(file: File, tag: NbtFile, compressed: Boolean = true, littleEndian: Boolean = false, writeHeaders: Boolean = false)

Writes the NbtFile in a File.

Parameters

jvm

   
file The NBT file that will be written on the output file
compressed If the file will be compressed by GZIPOutputStream
littleEndian Uses little endian to write to the stream as in Bedrock Edition
writeHeaders Writes the NbtFile.version and content size headers to the file. The NbtFile.length property will be updated when this flag is set to true. If NbtFile.version is null when this flag is true, 0 is assumed. The header is always written in little endian regardless of the littleEndian param.