public final class NBTOutputStream extends Object implements Closeable
This class writes NBT, or
Named Binary Tag Tag objects to an underlying
OutputStream.
The NBT format was created by Markus Persson, and the specification may be found at http://www.minecraft.net/docs/NBT.txt.
| Constructor and Description |
|---|
NBTOutputStream(OutputStream os)
Creates a new
NBTOutputStream, which will write data to the
specified underlying output stream in big endian byte order, or if the
output stream is already a DataOutput stream, in the stream's
default byte order. |
NBTOutputStream(OutputStream os,
boolean littleEndian)
Creates a new
NBTOutputStream, which will write data to the
specified underlying output stream. |
public NBTOutputStream(OutputStream os)
NBTOutputStream, which will write data to the
specified underlying output stream in big endian byte order, or if the
output stream is already a DataOutput stream, in the stream's
default byte order.os - The output stream.public NBTOutputStream(OutputStream os, boolean littleEndian)
NBTOutputStream, which will write data to the
specified underlying output stream.os - The output stream.littleEndian - Whether the data should be written in little endian
byte order.public void writeTag(Tag tag) throws IOException
tag - The tag to write.IOException - if an I/O error occurs.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOException