Package org.springframework.core.codec
Class ByteBufferDecoder
- java.lang.Object
- org.springframework.core.codec.AbstractDecoder<T>
- org.springframework.core.codec.AbstractDataBufferDecoder<ByteBuffer>
- org.springframework.core.codec.ByteBufferDecoder
- All Implemented Interfaces:
Decoder<ByteBuffer>
public class ByteBufferDecoder extends AbstractDataBufferDecoder<ByteBuffer>
Decoder forByteBuffers
.- Since:
- 5.0
- Author:
- Sebastien Deleuze, Arjen Poutsma, Rossen Stoyanchev
Field Summary
Fields inherited from class org.springframework.core.codec.AbstractDecoder
logger
Constructor Summary
Constructors Constructor Description ByteBufferDecoder()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canDecode(ResolvableType elementType, MimeType mimeType)
Whether the decoder supports the given target element type and the MIME type of the source stream.ByteBuffer
decode(DataBuffer dataBuffer, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)
Decode a data buffer to an Object of type T.Methods inherited from class org.springframework.core.codec.AbstractDataBufferDecoder
decode, decodeDataBuffer, decodeToMono, getMaxInMemorySize, setMaxInMemorySize
Methods inherited from class org.springframework.core.codec.AbstractDecoder
getDecodableMimeTypes, getLogger, setLogger
Constructor Detail
ByteBufferDecoder
public ByteBufferDecoder()
Method Detail
canDecode
public boolean canDecode(ResolvableType elementType, @Nullable MimeType mimeType)
Description copied from interface:Decoder
Whether the decoder supports the given target element type and the MIME type of the source stream.- Specified by:
canDecode
in interfaceDecoder<ByteBuffer>
- Overrides:
canDecode
in classAbstractDecoder<ByteBuffer>
- Parameters:
elementType
- the target element type for the output streammimeType
- the mime type associated with the stream to decode (can benull
if not specified)- Returns:
true
if supported,false
otherwise
decode
public ByteBuffer decode(DataBuffer dataBuffer, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
Description copied from interface:Decoder
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:
dataBuffer
- theDataBuffer
to decodeelementType
- the expected output typemimeType
- the MIME type associated with the datahints
- additional information about how to do encode- Returns:
- the decoded value, possibly
null