Package org.springframework.core.codec
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final CharsetThe default charset to use, i.e.The default delimiter strings to use, i.e.Fields inherited from class org.springframework.core.codec.AbstractDecoder
logger -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractCharSequenceDecoder(List<String> delimiters, boolean stripDelimiter, MimeType... mimeTypes) Create a newAbstractCharSequenceDecoderwith the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionfinal reactor.core.publisher.Flux<T>decode(Publisher<DataBuffer> input, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) Decode aDataBufferinput stream into a Flux ofT.final Tdecode(DataBuffer dataBuffer, ResolvableType elementType, MimeType mimeType, 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 org.springframework.core.codec.AbstractDataBufferDecoder
decodeDataBuffer, decodeToMono, getMaxInMemorySize, setMaxInMemorySizeMethods inherited from class org.springframework.core.codec.AbstractDecoder
canDecode, getDecodableMimeTypes, getLogger, setLoggerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.codec.Decoder
getDecodableMimeTypes
-
Field Details
-
DEFAULT_CHARSET
The default charset to use, i.e. "UTF-8". -
DEFAULT_DELIMITERS
The default delimiter strings to use, i.e.\r\nand\n.
-
-
Constructor Details
-
Method Details
-
setDefaultCharset
Set 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
-
getDefaultCharset
Return the configureddefaultCharset. -
decode
public 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 interfaceDecoder<T extends CharSequence>- Overrides:
decodein classAbstractDataBufferDecoder<T extends CharSequence>- Parameters:
input- 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 decode- Returns:
- the output stream with decoded elements
-
decode
public 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- theDataBufferto 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
-
decodeInternal
Template method that decodes the given data buffer intoT, given the charset.
-