public static final class StreamReadConstraints.Builder extends Object
| Modifier and Type | Method and Description |
|---|---|
StreamReadConstraints |
build() |
StreamReadConstraints.Builder |
maxDocumentLength(long maxDocLen)
Sets the maximum allowed document length (for positive values over 0) or
indicate that any length is acceptable (
0 or negative number). |
StreamReadConstraints.Builder |
maxNameLength(int maxNameLen)
Sets the maximum name length (in chars or bytes, depending on input context).
|
StreamReadConstraints.Builder |
maxNestingDepth(int maxNestingDepth)
Sets the maximum nesting depth.
|
StreamReadConstraints.Builder |
maxNumberLength(int maxNumLen)
Sets the maximum number length (in chars or bytes, depending on input context).
|
StreamReadConstraints.Builder |
maxStringLength(int maxStringLen)
Sets the maximum string length (in chars or bytes, depending on input context).
|
StreamReadConstraints.Builder |
maxTokenCount(long maxTokenCount)
Sets the maximum allowed token count (for positive values over 0) or
indicate that any count is acceptable (
0 or negative number). |
public StreamReadConstraints.Builder maxNestingDepth(int maxNestingDepth)
maxNestingDepth - the maximum depthIllegalArgumentException - if the maxNestingDepth is set to a negative valuepublic StreamReadConstraints.Builder maxDocumentLength(long maxDocLen)
0 or negative number).
The length is in input units of the input source, that is, in
bytes or chars.
The check is not done after every byte or character but checked when a new chunk of data is read. This means that the check is not likely to be exact but that documents smaller than this limit will be treated as valid.
maxDocLen - the maximum allowed document length if positive number above 0; otherwise
(0 or negative number) means "unlimited".public StreamReadConstraints.Builder maxTokenCount(long maxTokenCount)
0 or negative number).
A token is a single unit of input, such as a number, a string, an object start or end, or an array start or end.
maxTokenCount - the maximum allowed token count if positive number above 0; otherwise
(0 or negative number) means "unlimited".public StreamReadConstraints.Builder maxNumberLength(int maxNumLen)
maxNumLen - the maximum number length (in chars or bytes, depending on input context)IllegalArgumentException - if the maxNumLen is set to a negative valuepublic StreamReadConstraints.Builder maxStringLength(int maxStringLen)
Setting this value to lower than the maxNumberLength(int) is not recommended.
NOTE: Jackson 2.15.0 initially used a lower setting (5_000_000).
maxStringLen - the maximum string length (in chars or bytes, depending on input context)IllegalArgumentException - if the maxStringLen is set to a negative valuepublic StreamReadConstraints.Builder maxNameLength(int maxNameLen)
maxNameLen - the maximum string length (in chars or bytes, depending on input context)IllegalArgumentException - if the maxStringLen is set to a negative valuepublic StreamReadConstraints build()
Copyright © 2008–2025 FasterXML. All rights reserved.