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 forDecoderimplementations.- Since:
- 5.0
- Author:
- Sebastien Deleuze, Arjen Poutsma
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractDecoder(MimeType... supportedMimeTypes)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanDecode(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 aDataBufferinput stream into a Mono ofT.List<MimeType>getDecodableMimeTypes()Return the list of MIME types this decoder supports.LoggetLogger()Return the currently configured Logger.voidsetLogger(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:DecoderReturn the list of MIME types this decoder supports.- Specified by:
getDecodableMimeTypesin interfaceDecoder<T>
canDecode
public boolean canDecode(ResolvableType elementType, @Nullable MimeType mimeType)
Description copied from interface:DecoderWhether 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:DecoderDecode aDataBufferinput stream into a Mono ofT.- Specified by:
decodeToMonoin interfaceDecoder<T>- Parameters:
inputStream- theDataBufferinput 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