public final class NbtInputStream extends Object implements Closeable
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 and Description |
---|
NbtInputStream(InputStream is)
Creates 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.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
CompoundTag |
readCompound()
Reads the root NBT
CompoundTag from the stream. |
CompoundTag |
readCompound(NbtReadLimiter readLimiter)
Reads the root NBT
CompoundTag from the stream. |
public NbtInputStream(InputStream is) throws IOException
This assumes the stream is compressed.
is
- The input stream.IOException
- if an I/O error occurs.public NbtInputStream(InputStream is, boolean compressed) throws IOException
A flag must be passed which indicates if the stream is compressed with GZIP or not.
is
- The input stream.compressed
- A flag indicating if the stream is compressed.IOException
- if an I/O error occurs.public CompoundTag readCompound() throws IOException
CompoundTag
from the stream.IOException
- if an I/O error occurs.public CompoundTag readCompound(NbtReadLimiter readLimiter) throws IOException
CompoundTag
from the stream.readLimiter
- The read limiter to prevent overflow when reading the NBT data.IOException
- if an I/O error occurs.public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2021. All rights reserved.