Class AbstractCharSequenceDecoder<T extends CharSequence>
java.lang.Object
org.springframework.core.codec.AbstractDecoder<T>
org.springframework.core.codec.AbstractDataBufferDecoder<T>
org.springframework.core.codec.AbstractCharSequenceDecoder<T>
- Type Parameters:
- T- the character sequence type
- All Implemented Interfaces:
- Decoder<T>
- Direct Known Subclasses:
- CharBufferDecoder, StringDecoder
public abstract class AbstractCharSequenceDecoder<T extends CharSequence>
extends AbstractDataBufferDecoder<T>
Abstract base class that decodes from a data buffer stream to a
CharSequence stream.- Since:
- 6.1
- Author:
- Arjen Poutsma
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final CharsetThe default charset to use, i.e.The default delimiter strings to use, i.e.Fields inherited from class AbstractDecoderlogger
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAbstractCharSequenceDecoder(List<String> delimiters, boolean stripDelimiter, MimeType... mimeTypes) Create a newAbstractCharSequenceDecoderwith the given parameters.
- 
Method SummaryModifier and TypeMethodDescriptionfinal reactor.core.publisher.Flux<T> decode(Publisher<DataBuffer> input, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) Decode aDataBufferinput stream into a Flux ofT.final Tdecode(DataBuffer dataBuffer, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) Decode a data buffer to an Object of type T.protected abstract TdecodeInternal(DataBuffer dataBuffer, Charset charset) Template method that decodes the given data buffer intoT, given the charset.Return the configureddefaultCharset.voidsetDefaultCharset(Charset defaultCharset) Set the default character set to fall back on if the MimeType does not specify any.Methods inherited from class AbstractDataBufferDecoderdecodeDataBuffer, decodeToMono, getMaxInMemorySize, setMaxInMemorySizeMethods inherited from class AbstractDecodercanDecode, getDecodableMimeTypes, getLogger, setLoggerMethods inherited from class Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DecodergetDecodableMimeTypes
- 
Field Details- 
DEFAULT_CHARSETThe default charset to use, i.e. "UTF-8".
- 
DEFAULT_DELIMITERS
 
- 
- 
Constructor Details- 
AbstractCharSequenceDecoder
 
- 
- 
Method Details- 
setDefaultCharsetSet the default character set to fall back on if the MimeType does not specify any.By default this is UTF-8.- Parameters:
- defaultCharset- the charset to fall back on
 
- 
getDefaultCharsetReturn the configureddefaultCharset.
- 
decodepublic final 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.- Specified by:
- decodein interface- Decoder<T extends CharSequence>
- Overrides:
- decodein class- AbstractDataBufferDecoder<T extends CharSequence>
- 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(ResolvableType, 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
 
- 
decodepublic final T decode(DataBuffer dataBuffer, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) Description copied from interface:DecoderDecode 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- the- DataBufferto decode
- elementType- the expected output type
- mimeType- the MIME type associated with the data
- hints- additional information about how to do decode
- Returns:
- the decoded value, possibly null
 
- 
decodeInternalTemplate method that decodes the given data buffer intoT, given the charset.
 
-