Package net.glowstone.util.nbt
Class NbtInputStream
java.lang.Object
net.glowstone.util.nbt.NbtInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
This class reads NBT, or Named Binary Tag streams, and produces an object graph of subclasses of
the
Tag
object.
The NBT format was created by Markus Persson, and the specification may be found at http://www.minecraft.net/docs/NBT.txt.
-
Constructor Summary
ConstructorDescriptionCreates a new NBTInputStream, which will source its data from the specified input stream.NbtInputStream
(InputStream is, boolean compressed) Creates a new NBTInputStream, which sources its data from the specified input stream. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Reads the root NBTCompoundTag
from the stream.readCompound
(NbtReadLimiter readLimiter) Reads the root NBTCompoundTag
from the stream.
-
Constructor Details
-
NbtInputStream
Creates a new NBTInputStream, which will source its data from the specified input stream.This assumes the stream is compressed.
- Parameters:
is
- The input stream.- Throws:
IOException
- if an I/O error occurs.
-
NbtInputStream
Creates a new NBTInputStream, which sources its data from the specified input stream.A flag must be passed which indicates if the stream is compressed with GZIP or not.
- Parameters:
is
- The input stream.compressed
- A flag indicating if the stream is compressed.- Throws:
IOException
- if an I/O error occurs.
-
-
Method Details
-
readCompound
Reads the root NBTCompoundTag
from the stream.- Returns:
- The tag that was read.
- Throws:
IOException
- if an I/O error occurs.
-
readCompound
Reads the root NBTCompoundTag
from the stream.- Parameters:
readLimiter
- The read limiter to prevent overflow when reading the NBT data.- Returns:
- The tag that was read.
- Throws:
IOException
- if an I/O error occurs.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-