java.lang.Object
tools.jackson.core.StreamReadConstraints.Builder
- Enclosing class:
- StreamReadConstraints
-
Method Summary
Modifier and TypeMethodDescriptionbuild()maxDocumentLength(long maxDocLen) Sets the maximum allowed document length (for positive values over 0) or indicate that any length is acceptable (0or negative number).maxNameLength(int maxNameLen) Sets the maximum name length (in chars or bytes, depending on input context).maxNestingDepth(int maxNestingDepth) Sets the maximum nesting depth.maxNumberLength(int maxNumLen) Sets the maximum number length (in chars or bytes, depending on input context).maxStringLength(int maxStringLen) Sets the maximum string length (in chars or bytes, depending on input context).maxTokenCount(long maxTokenCount) Sets the maximum allowed token count (for positive values over 0) or indicate that any count is acceptable (0or negative number).
-
Method Details
-
maxNestingDepth
Sets the maximum nesting depth. The depth is a count of objects and arrays that have not been closed, `{` and `[` respectively.- Parameters:
maxNestingDepth- the maximum depth- Returns:
- this builder
- Throws:
IllegalArgumentException- if the maxNestingDepth is set to a negative value
-
maxDocumentLength
Sets the maximum allowed document length (for positive values over 0) or indicate that any length is acceptable (0or negative number). The length is in input units of the input source, that is, inbytes orchars.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.
- Parameters:
maxDocLen- the maximum allowed document length if positive number above 0; otherwise (0or negative number) means "unlimited".- Returns:
- this builder
-
maxTokenCount
Sets the maximum allowed token count (for positive values over 0) or indicate that any count is acceptable (0or 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.
- Parameters:
maxTokenCount- the maximum allowed token count if positive number above 0; otherwise (0or negative number) means "unlimited".- Returns:
- this builder
- Since:
- 2.18
-
maxNumberLength
Sets the maximum number length (in chars or bytes, depending on input context). The default is 1000.- Parameters:
maxNumLen- the maximum number length (in chars or bytes, depending on input context)- Returns:
- this builder
- Throws:
IllegalArgumentException- if the maxNumLen is set to a negative value
-
maxStringLength
Sets the maximum string length (in chars or bytes, depending on input context). The default is 20,000,000. This limit is not exact, the limit is applied when we increase internal buffer sizes and an exception will happen at sizes greater than this limit. Some text values that are a little bigger than the limit may be treated as valid but no text values with sizes less than or equal to this limit will be treated as invalid.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).
- Parameters:
maxStringLen- the maximum string length (in chars or bytes, depending on input context)- Returns:
- this builder
- Throws:
IllegalArgumentException- if the maxStringLen is set to a negative value
-
maxNameLength
Sets the maximum name length (in chars or bytes, depending on input context). The default is 50,000. This limit is not exact, the limit is applied when we increase internal buffer sizes and an exception will happen at sizes greater than this limit. Some text values that are a little bigger than the limit may be treated as valid but no text values with sizes less than or equal to this limit will be treated as invalid.- Parameters:
maxNameLen- the maximum string length (in chars or bytes, depending on input context)- Returns:
- this builder
- Throws:
IllegalArgumentException- if the maxStringLen is set to a negative value- Since:
- 2.16.0
-
build
-