public class NbtReadTracker
extends java.lang.Object
unlimited().| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_BYTES
The default max bytes that can be read.
|
static int |
DEFAULT_MAX_DEPTH
The default max depth that can be read.
|
| Constructor and Description |
|---|
NbtReadTracker()
Create a new read tracker with the default max bytes (
DEFAULT_MAX_BYTES) and max depth (DEFAULT_MAX_DEPTH). |
NbtReadTracker(int maxBytes)
Create a new read tracker with the given max bytes and the default max depth (
DEFAULT_MAX_DEPTH). |
NbtReadTracker(int maxDepth,
int maxBytes)
Create a new read tracker with the given max bytes and max depth.
|
| Modifier and Type | Method and Description |
|---|---|
void |
popDepth()
Pop a depth level.
|
void |
pushDepth()
Push a new depth level.
|
void |
read(int bytes)
Read the given amount of bytes.
|
static NbtReadTracker |
unlimited()
Create an unlimited read tracker.
|
public static final int DEFAULT_MAX_BYTES
public static final int DEFAULT_MAX_DEPTH
public NbtReadTracker()
DEFAULT_MAX_BYTES) and max depth (DEFAULT_MAX_DEPTH).public NbtReadTracker(int maxBytes)
DEFAULT_MAX_DEPTH).maxBytes - The max bytes that can be readpublic NbtReadTracker(int maxDepth,
int maxBytes)
maxDepth - The max depth that can be readmaxBytes - The max bytes that can be readpublic static NbtReadTracker unlimited()
DEFAULT_MAX_DEPTH) is still limited.public void pushDepth()
throws NbtReadException
NbtReadException - If the max depth is reachedpublic void popDepth()
public void read(int bytes)
throws NbtReadException
bytes - The amount of bytes that were readNbtReadException - If the max bytes were exceeded