classSource
public class Writer

Constructors

public Writer()

Methods

public static void writeFile(File file, NbtCompound nbt) throws IOException
Writes the given NBT tree to a file, Gzip compressed (like the original Minecraft nbt files) Goes through a temp file, so a crash halfway through doesn't leave you with half a level.dat
Parameters
fileFileTarget file
nbtNbtCompoundRoot compound, e.g. as returned by Parser.readFile
Throws
IOExceptionIf writing fails, the old file is still fine then
public static void writeFile(File file, NbtCompound nbt, File backup) throws IOException
Like writeFile(File, NbtCompound), but the old file is copied to backup first (think level.dat_old)
Parameters
fileFile
nbtNbtCompound
backupFile
Throws
IOExceptionIf writing or copying fails, the old file is still fine then
public static void writeFileUncompressed(File file, NbtCompound nbt) throws IOException
Writes the given NBT tree uncompressed. Useful for debugging or formats that don't expect Gzip (e.g. individual chunk payloads that are compressed at the region-file level instead). Also goes through a temp file
Parameters
fileFile
nbtNbtCompound
Throws
IOException