Class AbstractDataBufferDecoder<T>
- Type Parameters:
- T- the element type
- All Implemented Interfaces:
- Decoder<T>
- Direct Known Subclasses:
- AbstractCharSequenceDecoder,- ByteArrayDecoder,- ByteBufferDecoder,- DataBufferDecoder,- Netty5BufferDecoder,- NettyByteBufDecoder,- ResourceDecoder
Decoder implementations that can decode
 a DataBuffer directly to the target element type.
 Sub-classes must implement decodeDataBuffer(org.springframework.core.io.buffer.DataBuffer, org.springframework.core.ResolvableType, org.springframework.util.MimeType, java.util.Map<java.lang.String, java.lang.Object>) to provide a way to
 transform a DataBuffer to the target data type. The default
 decode(org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer>, org.springframework.core.ResolvableType, org.springframework.util.MimeType, java.util.Map<java.lang.String, java.lang.Object>) implementation transforms each individual data buffer while
 decodeToMono(org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer>, org.springframework.core.ResolvableType, org.springframework.util.MimeType, java.util.Map<java.lang.String, java.lang.Object>) applies "reduce" and transforms the aggregated buffer.
 
Sub-classes can override decode(org.reactivestreams.Publisher<org.springframework.core.io.buffer.DataBuffer>, org.springframework.core.ResolvableType, org.springframework.util.MimeType, java.util.Map<java.lang.String, java.lang.Object>) in order to split the input stream
 along different boundaries (e.g. on new line characters for String)
 or always reduce to a single data buffer (e.g. Resource).
- Since:
- 5.0
- Author:
- Rossen Stoyanchev
- 
Field SummaryFields inherited from class org.springframework.core.codec.AbstractDecoderlogger
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAbstractDataBufferDecoder(MimeType... supportedMimeTypes) 
- 
Method SummaryModifier and TypeMethodDescriptionreactor.core.publisher.Flux<T>decode(Publisher<DataBuffer> input, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) Decode aDataBufferinput stream into a Flux ofT.protected TdecodeDataBuffer(DataBuffer buffer, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) Deprecated.reactor.core.publisher.Mono<T>decodeToMono(Publisher<DataBuffer> input, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) Decode aDataBufferinput stream into a Mono ofT.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.core.codec.AbstractDecodercanDecode, getDecodableMimeTypes, getLogger, setLoggerMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.codec.Decoderdecode, getDecodableMimeTypes
- 
Constructor Details- 
AbstractDataBufferDecoder
 
- 
- 
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, e.g. 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
- Since:
- 5.1.11
 
- 
getMaxInMemorySizepublic int getMaxInMemorySize()Return theconfiguredbyte count limit.- Since:
- 5.1.11
 
- 
decodepublic reactor.core.publisher.Flux<T> decode(Publisher<DataBuffer> input, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) Description copied from interface:DecoderDecode aDataBufferinput stream into a Flux ofT.- Parameters:
- input- 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<T> decodeToMono(Publisher<DataBuffer> input, 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>
- Overrides:
- decodeToMonoin class- AbstractDecoder<T>
- Parameters:
- input- 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
 
- 
decodeDataBuffer@Deprecated @Nullable protected T decodeDataBuffer(DataBuffer buffer, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) Deprecated.as of 5.2, please implementDecoder.decode(DataBuffer, ResolvableType, MimeType, Map)insteadHow to decode aDataBufferto the target element type.
 
- 
Decoder.decode(DataBuffer, ResolvableType, MimeType, Map)instead