Class KotlinSerializationJsonDecoder
java.lang.Object
org.springframework.core.codec.AbstractDecoder<Object>
org.springframework.http.codec.json.KotlinSerializationJsonDecoder
Decode a byte stream into JSON and convert to Object's with
 kotlinx.serialization.
 
This decoder can be used to bind @Serializable Kotlin classes,
 open polymorphic serialization
 is not supported.
 It supports application/json and application/*+json with
 various character sets, UTF-8 being the default.
 
Decoding streams is not supported yet, see kotlinx.serialization/issues/1073 related issue.
- Since:
- 5.3
- Author:
- Sebastien Deleuze
- 
Field SummaryFields inherited from class org.springframework.core.codec.AbstractDecoderlogger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleancanDecode(ResolvableType elementType, MimeType mimeType) Whether the decoder supports the given target element type and the MIME type of the source stream.reactor.core.publisher.Flux<Object>decode(Publisher<DataBuffer> inputStream, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) Decode aDataBufferinput stream into a Flux ofT.reactor.core.publisher.Mono<Object>decodeToMono(Publisher<DataBuffer> inputStream, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) Decode aDataBufferinput stream into a Mono ofT.intReturn theconfiguredbyte count limit.voidsetMaxInMemorySize(int byteCount) Configure a limit on the number of bytes that can be buffered whenever the input stream needs to be aggregated.Methods inherited from class org.springframework.core.codec.AbstractDecodergetDecodableMimeTypes, getLogger, setLoggerMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.codec.Decoderdecode, getDecodableMimeTypes
- 
Constructor Details- 
KotlinSerializationJsonDecoderpublic KotlinSerializationJsonDecoder()
- 
KotlinSerializationJsonDecoderpublic KotlinSerializationJsonDecoder(kotlinx.serialization.json.Json json) 
 
- 
- 
Method Details- 
setMaxInMemorySizepublic void setMaxInMemorySize(int byteCount) Configure a limit on the number of bytes that can be buffered whenever the input stream needs to be aggregated. This can be a result of decoding to a singleDataBuffer,ByteBuffer,byte[],Resource,String, etc. It can also occur when splitting the input stream, e.g. delimited text, in which case the limit applies to data buffered between delimiters.By default this is set to 256K. - Parameters:
- byteCount- the max number of bytes to buffer, or -1 for unlimited
 
- 
getMaxInMemorySizepublic int getMaxInMemorySize()Return theconfiguredbyte count limit.
- 
canDecodeDescription copied from interface:DecoderWhether the decoder supports the given target element type and the MIME type of the source stream.- Specified by:
- canDecodein interface- Decoder<Object>
- Overrides:
- canDecodein class- AbstractDecoder<Object>
- Parameters:
- elementType- the target element type for the output stream
- mimeType- the mime type associated with the stream to decode (can be- nullif not specified)
- Returns:
- trueif supported,- falseotherwise
 
- 
decodepublic reactor.core.publisher.Flux<Object> decode(Publisher<DataBuffer> inputStream, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) Description copied from interface:DecoderDecode aDataBufferinput stream into a Flux ofT.- Parameters:
- inputStream- the- DataBufferinput stream to decode
- elementType- 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 (optional)
- hints- additional information about how to do decode
- Returns:
- the output stream with decoded elements
 
- 
decodeToMonopublic reactor.core.publisher.Mono<Object> decodeToMono(Publisher<DataBuffer> inputStream, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) Description copied from interface:DecoderDecode aDataBufferinput stream into a Mono ofT.- Specified by:
- decodeToMonoin interface- Decoder<Object>
- Overrides:
- decodeToMonoin class- AbstractDecoder<Object>
- Parameters:
- inputStream- the- DataBufferinput stream to decode
- elementType- 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 (optional)
- hints- additional information about how to do decode
- Returns:
- the output stream with the decoded element
 
 
-