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