Package org.springframework.http.codec
Class KotlinSerializationBinaryDecoder<T extends kotlinx.serialization.BinaryFormat>
java.lang.Object
org.springframework.http.codec.KotlinSerializationSupport<T>
org.springframework.http.codec.KotlinSerializationBinaryDecoder<T>
- Type Parameters:
- T- the type of- BinaryFormat
- Direct Known Subclasses:
- KotlinSerializationCborDecoder,- KotlinSerializationProtobufDecoder
public abstract class KotlinSerializationBinaryDecoder<T extends kotlinx.serialization.BinaryFormat>
extends KotlinSerializationSupport<T>
implements Decoder<Object>
Abstract base class for 
Decoder implementations that defer to Kotlin
 binary serializers.- Since:
- 6.0
- Author:
- Sebastien Deleuze, Iain Henderson, Arjen Poutsma
- 
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.Return the list of MIME types supported by this Decoder.getDecodableMimeTypes(ResolvableType targetType) Return the list of MIME types supported by this Decoder for the given type of element.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.http.codec.KotlinSerializationSupportcanSerialize, format, serializer, supportedMimeTypes
- 
Constructor Details- 
KotlinSerializationBinaryDecoder
 
- 
- 
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, for example, 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.
- 
getDecodableMimeTypesDescription copied from interface:DecoderReturn the list of MIME types supported by this Decoder. The list may not apply to every possible target element type and calls to this method should typically be guarded viacanDecode(elementType, null). The list may also exclude MIME types supported only for a specific element type. Alternatively, useDecoder.getDecodableMimeTypes(ResolvableType)for a more precise list.- Specified by:
- getDecodableMimeTypesin interface- Decoder<T extends kotlinx.serialization.BinaryFormat>
- Returns:
- the list of supported MIME types
 
- 
getDecodableMimeTypesDescription copied from interface:DecoderReturn the list of MIME types supported by this Decoder for the given type of element. This list may differ fromDecoder.getDecodableMimeTypes()if the Decoder doesn't support the given element type or if it supports it only for a subset of MIME types.- Specified by:
- getDecodableMimeTypesin interface- Decoder<T extends kotlinx.serialization.BinaryFormat>
- Parameters:
- targetType- the type of element to check for decoding
- Returns:
- the list of MIME types supported for the given target type
 
- 
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.- Specified by:
- decodein interface- Decoder<T extends kotlinx.serialization.BinaryFormat>
- 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<T extends kotlinx.serialization.BinaryFormat>
- 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
 
 
-