public class DataBufferDecoder extends AbstractDataBufferDecoder<DataBuffer>
DataBuffers
.
Note: The data buffers should be released via
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(PooledDataBuffer.class, DataBufferUtils::release)
to the
composition chain to ensure cached data buffers are released prior to an
error or cancellation signal.
logger
Constructor and Description |
---|
DataBufferDecoder() |
Modifier and Type | Method and Description |
---|---|
boolean |
canDecode(ResolvableType elementType,
MimeType mimeType)
Whether the decoder supports the given target element type and the MIME
type of the source stream.
|
DataBuffer |
decode(DataBuffer buffer,
ResolvableType elementType,
MimeType mimeType,
Map<String,Object> hints)
Decode a data buffer to an Object of type T.
|
reactor.core.publisher.Flux<DataBuffer> |
decode(Publisher<DataBuffer> input,
ResolvableType elementType,
MimeType mimeType,
Map<String,Object> hints)
Decode a
DataBuffer input stream into a Flux of T . |
decodeDataBuffer, decodeToMono, getMaxInMemorySize, setMaxInMemorySize
getDecodableMimeTypes, getLogger, setLogger
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDecodableMimeTypes
public boolean canDecode(ResolvableType elementType, @Nullable MimeType mimeType)
Decoder
canDecode
in interface Decoder<DataBuffer>
canDecode
in class AbstractDecoder<DataBuffer>
elementType
- the target element type for the output streammimeType
- the mime type associated with the stream to decode
(can be null
if not specified)true
if supported, false
otherwisepublic reactor.core.publisher.Flux<DataBuffer> decode(Publisher<DataBuffer> input, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
Decoder
DataBuffer
input stream into a Flux of T
.decode
in interface Decoder<DataBuffer>
decode
in class AbstractDataBufferDecoder<DataBuffer>
input
- the DataBuffer
input stream to decodeelementType
- 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 decodepublic DataBuffer decode(DataBuffer buffer, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
Decoder
buffer
- the DataBuffer
to decodeelementType
- the expected output typemimeType
- the MIME type associated with the datahints
- additional information about how to do decodenull