public class StreamReadConstraints extends Object implements Serializable
TokenStreamFactory
(such as
JsonFactory
); if nothing explicitly specified, default
constraints are used.
Currently constrained aspects, with default settings, are:
DEFAULT_MAX_NUM_LEN
)
DEFAULT_MAX_STRING_LEN
)
DEFAULT_MAX_DEPTH
)
Modifier and Type | Class and Description |
---|---|
static class |
StreamReadConstraints.Builder |
Modifier and Type | Field and Description |
---|---|
protected int |
_maxNestingDepth |
protected int |
_maxNumLen |
protected int |
_maxStringLen |
static int |
DEFAULT_MAX_DEPTH
Default setting for maximum depth: see
StreamReadConstraints.Builder.maxNestingDepth(int) for details. |
static int |
DEFAULT_MAX_NUM_LEN
Default setting for maximum number length: see
StreamReadConstraints.Builder.maxNumberLength(int) for details. |
static int |
DEFAULT_MAX_STRING_LEN
Default setting for maximum string length: see
StreamReadConstraints.Builder.maxStringLength(int) for details. |
Modifier and Type | Method and Description |
---|---|
static StreamReadConstraints.Builder |
builder() |
static StreamReadConstraints |
defaults() |
int |
getMaxNestingDepth()
Accessor for maximum depth.
|
int |
getMaxNumberLength()
Accessor for maximum length of numbers to decode.
|
int |
getMaxStringLength()
Accessor for maximum length of strings to decode.
|
StreamReadConstraints.Builder |
rebuild() |
void |
validateFPLength(int length)
Convenience method that can be used to verify that a floating-point
number of specified length does not exceed maximum specified by this
constraints object: if it does, a
StreamConstraintsException
is thrown. |
void |
validateIntegerLength(int length)
Convenience method that can be used to verify that an integer
number of specified length does not exceed maximum specific by this
constraints object: if it does, a
StreamConstraintsException
is thrown. |
void |
validateNestingDepth(int depth)
Convenience method that can be used to verify that the
nesting depth does not exceed the maximum specified by this
constraints object: if it does, a
StreamConstraintsException
is thrown. |
void |
validateStringLength(int length)
Convenience method that can be used to verify that a String
of specified length does not exceed maximum specific by this
constraints object: if it does, a
StreamConstraintsException
is thrown. |
public static final int DEFAULT_MAX_DEPTH
StreamReadConstraints.Builder.maxNestingDepth(int)
for details.public static final int DEFAULT_MAX_NUM_LEN
StreamReadConstraints.Builder.maxNumberLength(int)
for details.public static final int DEFAULT_MAX_STRING_LEN
StreamReadConstraints.Builder.maxStringLength(int)
for details.protected final int _maxNestingDepth
protected final int _maxNumLen
protected final int _maxStringLen
public static StreamReadConstraints.Builder builder()
public static StreamReadConstraints defaults()
public StreamReadConstraints.Builder rebuild()
StreamReadConstraints.Builder
initialized with settings of this constraints
instancepublic int getMaxNestingDepth()
StreamReadConstraints.Builder.maxNestingDepth(int)
for details.public int getMaxNumberLength()
StreamReadConstraints.Builder.maxNumberLength(int)
for details.public int getMaxStringLength()
StreamReadConstraints.Builder.maxStringLength(int)
for details.public void validateFPLength(int length) throws StreamConstraintsException
StreamConstraintsException
is thrown.length
- Length of number in input unitsStreamConstraintsException
- If length exceeds maximumpublic void validateIntegerLength(int length) throws StreamConstraintsException
StreamConstraintsException
is thrown.length
- Length of number in input unitsStreamConstraintsException
- If length exceeds maximumpublic void validateStringLength(int length) throws StreamConstraintsException
StreamConstraintsException
is thrown.length
- Length of string in input unitsStreamConstraintsException
- If length exceeds maximumpublic void validateNestingDepth(int depth) throws StreamConstraintsException
StreamConstraintsException
is thrown.depth
- count of unclosed objects and arraysStreamConstraintsException
- If depth exceeds maximumCopyright © 2008–2023 FasterXML. All rights reserved.