Package org.springframework.core.codec
Class ByteArrayDecoder
java.lang.Object
org.springframework.core.codec.AbstractDecoder<T>
org.springframework.core.codec.AbstractDataBufferDecoder<byte[]>
org.springframework.core.codec.ByteArrayDecoder
- All Implemented Interfaces:
Decoder<byte[]>
Decoder for
byte
arrays.- Since:
- 5.0
- Author:
- Arjen Poutsma, Rossen Stoyanchev
-
Field Summary
Fields inherited from class org.springframework.core.codec.AbstractDecoder
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canDecode
(ResolvableType elementType, MimeType mimeType) Whether the decoder supports the given target element type and the MIME type of the source stream.byte[]
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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.core.codec.Decoder
getDecodableMimeTypes
-
Constructor Details
-
ByteArrayDecoder
public ByteArrayDecoder()
-
-
Method Details
-
canDecode
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<byte[]>
- Overrides:
canDecode
in classAbstractDecoder<byte[]>
- 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 byte[] 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 decode- Returns:
- the decoded value, possibly
null
-