class JsonObjectDecoder extends AbstractDecoder<DataBuffer>
This class does not do any real parsing or validation. A sequence of bytes is considered a JSON object/array if it contains a matching number of opening and closing braces/brackets.
Based on Netty JsonObjectDecoder
Modifier and Type | Field and Description |
---|---|
private int |
maxObjectLength |
private static int |
ST_CORRUPTED |
private static int |
ST_DECODING_ARRAY_STREAM |
private static int |
ST_DECODING_NORMAL |
private static int |
ST_INIT |
private boolean |
streamArrayElements |
Constructor and Description |
---|
JsonObjectDecoder() |
JsonObjectDecoder(boolean streamArrayElements) |
JsonObjectDecoder(int maxObjectLength) |
JsonObjectDecoder(int maxObjectLength,
boolean streamArrayElements) |
Modifier and Type | Method and Description |
---|---|
<any> |
decode(<any> inputStream,
ResolvableType elementType,
MimeType mimeType,
java.util.Map<java.lang.String,java.lang.Object> hints)
Decode a
DataBuffer input stream into a Flux of T . |
canDecode, decodeToMono, getDecodableMimeTypes
private static final int ST_CORRUPTED
private static final int ST_INIT
private static final int ST_DECODING_NORMAL
private static final int ST_DECODING_ARRAY_STREAM
private final int maxObjectLength
private final boolean streamArrayElements
public JsonObjectDecoder()
public JsonObjectDecoder(int maxObjectLength)
public JsonObjectDecoder(boolean streamArrayElements)
public JsonObjectDecoder(int maxObjectLength, boolean streamArrayElements)
maxObjectLength
- maximum number of bytes a JSON object/array may
use (including braces and all). Objects exceeding this length are dropped
and an IllegalStateException
is thrown.streamArrayElements
- if set to true and the "top level" JSON object
is an array, each of its entries is passed through the pipeline individually
and immediately after it was fully received, allowing for arrays withpublic <any> decode(<any> inputStream, ResolvableType elementType, MimeType mimeType, java.util.Map<java.lang.String,java.lang.Object> hints)
Decoder
DataBuffer
input stream into a Flux of T
.inputStream
- the DataBuffer
input stream to decodeelementType
- the expected type of elements in the output stream;
this type must have been previously passed to the Decoder.canDecode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)
method and it must have returned true
.mimeType
- the MIME type associated with the input stream, optionalhints
- additional information about how to do encode