Top Description Constructors Methods
org.springframework.core.codec

public Class DataBufferDecoder

extends AbstractDataBufferDecoder<DataBuffer>
Class Inheritance
Imports
java.util.Map, org.reactivestreams.Publisher, reactor.core.publisher.Flux, org.springframework.core.ResolvableType, org.springframework.core.io.buffer.DataBuffer, org.springframework.lang.Nullable, org.springframework.util.MimeType, .MimeTypeUtils

Simple pass-through decoder for DataBuffers.

Note

The data buffers should be released via org.springframework.core.io.buffer.DataBufferUtils#release(DataBuffer) after they have been consumed. In addition, if using Flux or Mono operators such as flatMap, reduce, and others that prefetch, cache, and skip or filter out data items internally, please add doOnDiscard(DataBuffer.class, DataBufferUtils::release) to the composition chain to ensure cached data buffers are released prior to an error or cancellation signal.

Authors
Arjen Poutsma, Rossen Stoyanchev
Since
5.0

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
canDecode(ResolvableType
the target element type for the output stream
elementType
,
MimeType
the mime type associated with the stream to decode (can be null if not specified)
mimeType
)

Overrides org.springframework.core.codec.AbstractDecoder.canDecode.

Implements org.springframework.core.codec.Decoder.canDecode.

Whether the decoder supports the given target element type and the MIME type of the source stream.

public Flux<DataBuffer>
decode(Publisher<DataBuffer>
the DataBuffer input stream to decode
input
,
ResolvableType
the expected type of elements in the output stream; this type must have been previously passed to the canDecode method and it must have returned true.
elementType
,
MimeType
the MIME type associated with the input stream (optional)
mimeType
,
Map<String, Object>
additional information about how to do decode
hints
)

Overrides org.springframework.core.codec.AbstractDataBufferDecoder.decode.

Implements org.springframework.core.codec.Decoder.decode.

Decode a DataBuffer input stream into a Flux of T.

public DataBuffer
decode(DataBuffer
the DataBuffer to decode
buffer
,
ResolvableType
the expected output type
elementType
,
MimeType
the MIME type associated with the data
mimeType
,
Map<String, Object>
additional information about how to do decode
hints
)

Overrides default org.springframework.core.codec.Decoder.decode.

Decode a data buffer to an Object of type T.

Inherited from org.springframework.core.codec.AbstractDataBufferDecoder:
decodeDataBufferdecodeToMonogetMaxInMemorySizesetMaxInMemorySize

Constructor Detail

DataBufferDecoderback to summary
public DataBufferDecoder()

Method Detail

canDecodeback to summary
public boolean canDecode(ResolvableType elementType, MimeType mimeType)

Overrides org.springframework.core.codec.AbstractDecoder.canDecode.

Implements org.springframework.core.codec.Decoder.canDecode.

Doc from org.springframework.core.codec.Decoder.canDecode.

Whether the decoder supports the given target element type and the MIME type of the source stream.

Parameters
elementType:ResolvableType

the target element type for the output stream

mimeType:MimeType

the mime type associated with the stream to decode (can be null if not specified)

Returns:boolean

true if supported, false otherwise

Annotations
@Override
decodeback to summary
public Flux<DataBuffer> decode(Publisher<DataBuffer> input, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints)

Overrides org.springframework.core.codec.AbstractDataBufferDecoder.decode.

Implements org.springframework.core.codec.Decoder.decode.

Doc from org.springframework.core.codec.Decoder.decode.

Decode a DataBuffer input stream into a Flux of T.

Parameters
input:Publisher<DataBuffer>

the DataBuffer input stream to decode

elementType:ResolvableType

the expected type of elements in the output stream; this type must have been previously passed to the canDecode method and it must have returned true.

mimeType:MimeType

the MIME type associated with the input stream (optional)

hints:Map<String, Object>

additional information about how to do decode

Returns:Flux<DataBuffer>

the output stream with decoded elements

Annotations
@Override
decodeback to summary
public DataBuffer decode(DataBuffer buffer, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints)

Overrides default org.springframework.core.codec.Decoder.decode.

Doc from org.springframework.core.codec.Decoder.decode.

Decode a data buffer to an Object of type T. This is useful for scenarios, that distinct messages (or events) are decoded and handled individually, in fully aggregated form.

Parameters
buffer:DataBuffer

the DataBuffer to decode

elementType:ResolvableType

the expected output type

mimeType:MimeType

the MIME type associated with the data

hints:Map<String, Object>

additional information about how to do decode

Returns:DataBuffer

the decoded value, possibly null

Annotations
@Override