Package org.springframework.core.codec
Class AbstractDecoder<T>
- java.lang.Object
- org.springframework.core.codec.AbstractDecoder<T>
- Type Parameters:
T
- the element type
- All Implemented Interfaces:
Decoder<T>
- Direct Known Subclasses:
AbstractDataBufferDecoder
,Jaxb2XmlDecoder
,XmlEventDecoder
public abstract class AbstractDecoder<T> extends Object implements Decoder<T>
Abstract base class forDecoder
implementations.- Since:
- 5.0
- Author:
- Sebastien Deleuze, Arjen Poutsma
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractDecoder(MimeType... supportedMimeTypes)
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.reactor.core.publisher.Mono<T>
decodeToMono(org.reactivestreams.Publisher<DataBuffer> inputStream, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)
Decode aDataBuffer
input stream into a Mono ofT
.List<MimeType>
getDecodableMimeTypes()
Return the list of MIME types this decoder supports.Log
getLogger()
Return the currently configured Logger.void
setLogger(Log logger)
Set an alternative logger to use than the one based on the class name.
Constructor Detail
AbstractDecoder
protected AbstractDecoder(MimeType... supportedMimeTypes)
Method Detail
setLogger
public void setLogger(Log logger)
Set an alternative logger to use than the one based on the class name.- Parameters:
logger
- the logger to use- Since:
- 5.1
getDecodableMimeTypes
public List<MimeType> getDecodableMimeTypes()
Description copied from interface:Decoder
Return the list of MIME types this decoder supports.- Specified by:
getDecodableMimeTypes
in interfaceDecoder<T>
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.
decodeToMono
public reactor.core.publisher.Mono<T> decodeToMono(org.reactivestreams.Publisher<DataBuffer> inputStream, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
Description copied from interface:Decoder
Decode aDataBuffer
input stream into a Mono ofT
.- Specified by:
decodeToMono
in interfaceDecoder<T>
- Parameters:
inputStream
- theDataBuffer
input stream to decodeelementType
- the expected type of elements in the output stream; this type must have been previously passed to theDecoder.canDecode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)
method and it must have returnedtrue
.mimeType
- the MIME type associated with the input stream (optional)hints
- additional information about how to do encode- Returns:
- the output stream with the decoded element