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
All Implemented Interfaces:
org.springframework.core.codec.Decoder<Object>
Direct Known Subclasses:
KotlinSerializationCborDecoder, KotlinSerializationProtobufDecoder

public abstract class KotlinSerializationBinaryDecoder<T extends kotlinx.serialization.BinaryFormat> extends KotlinSerializationSupport<T> implements org.springframework.core.codec.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 Details

    • KotlinSerializationBinaryDecoder

      public KotlinSerializationBinaryDecoder(T format, org.springframework.util.MimeType... supportedMimeTypes)
  • Method Details

    • setMaxInMemorySize

      public 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 single DataBuffer, 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
    • getMaxInMemorySize

      public int getMaxInMemorySize()
      Return the configured byte count limit.
    • canDecode

      public boolean canDecode(org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType)
      Specified by:
      canDecode in interface org.springframework.core.codec.Decoder<T extends kotlinx.serialization.BinaryFormat>
    • getDecodableMimeTypes

      public List<org.springframework.util.MimeType> getDecodableMimeTypes()
      Specified by:
      getDecodableMimeTypes in interface org.springframework.core.codec.Decoder<T extends kotlinx.serialization.BinaryFormat>
    • getDecodableMimeTypes

      public List<org.springframework.util.MimeType> getDecodableMimeTypes(org.springframework.core.ResolvableType targetType)
      Specified by:
      getDecodableMimeTypes in interface org.springframework.core.codec.Decoder<T extends kotlinx.serialization.BinaryFormat>
    • decode

      public reactor.core.publisher.Flux<Object> decode(Publisher<org.springframework.core.io.buffer.DataBuffer> inputStream, org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)
      Specified by:
      decode in interface org.springframework.core.codec.Decoder<T extends kotlinx.serialization.BinaryFormat>
    • decodeToMono

      public reactor.core.publisher.Mono<Object> decodeToMono(Publisher<org.springframework.core.io.buffer.DataBuffer> inputStream, org.springframework.core.ResolvableType elementType, @Nullable org.springframework.util.MimeType mimeType, @Nullable Map<String,Object> hints)
      Specified by:
      decodeToMono in interface org.springframework.core.codec.Decoder<T extends kotlinx.serialization.BinaryFormat>