Class AbstractDataBufferDecoder<T>

java.lang.Object
org.springframework.core.codec.AbstractDecoder<T>
org.springframework.core.codec.AbstractDataBufferDecoder<T>
Type Parameters:
T - the element type
All Implemented Interfaces:
Decoder<T>
Direct Known Subclasses:
AbstractCharSequenceDecoder, ByteArrayDecoder, ByteBufferDecoder, DataBufferDecoder, GsonDecoder, NettyByteBufDecoder, ResourceDecoder

public abstract class AbstractDataBufferDecoder<T> extends AbstractDecoder<T>
Abstract base class for Decoder implementations that can decode a DataBuffer directly to the target element type.

Sub-classes must implement decodeDataBuffer(DataBuffer, ResolvableType, MimeType, Map) to provide a way to transform a DataBuffer to the target data type. The default decode(Publisher, ResolvableType, MimeType, Map) implementation transforms each individual data buffer while decodeToMono(Publisher, ResolvableType, MimeType, Map) applies "reduce" and transforms the aggregated buffer.

Sub-classes can override decode(Publisher, ResolvableType, MimeType, Map) in order to split the input stream along different boundaries (for example, on new line characters for String) or always reduce to a single data buffer (for example, Resource).

Since:
5.0
Author:
Rossen Stoyanchev
  • Constructor Details

    • AbstractDataBufferDecoder

      protected AbstractDataBufferDecoder(MimeType... supportedMimeTypes)
  • Method Details