Package org.springframework.core.codec
Class CharBufferDecoder
java.lang.Object
org.springframework.core.codec.AbstractDecoder<T>
org.springframework.core.codec.AbstractDataBufferDecoder<T>
org.springframework.core.codec.AbstractCharSequenceDecoder<CharBuffer>
org.springframework.core.codec.CharBufferDecoder
- All Implemented Interfaces:
- Decoder<CharBuffer>
Decode from a data buffer stream to a 
CharBuffer stream, either splitting
 or aggregating incoming data chunks to realign along newlines delimiters
 and produce a stream of char buffers. This is useful for streaming but is also
 necessary to ensure that multi-byte characters can be decoded correctly,
 avoiding split-character issues. The default delimiters used by default are
 \n and \r\n but that can be customized.- Since:
- 6.1
- Author:
- Markus Heiden, Arjen Poutsma
- See Also:
- 
Field SummaryFields inherited from class org.springframework.core.codec.AbstractCharSequenceDecoderDEFAULT_CHARSET, DEFAULT_DELIMITERSFields inherited from class org.springframework.core.codec.AbstractDecoderlogger
- 
Constructor SummaryConstructorsConstructorDescriptionCharBufferDecoder(List<String> delimiters, boolean stripDelimiter, MimeType... mimeTypes) 
- 
Method SummaryModifier and TypeMethodDescriptionstatic CharBufferDecoderCreate aCharBufferDecoderthat supports all MIME types.static CharBufferDecoderallMimeTypes(List<String> delimiters, boolean stripDelimiter) Create aCharBufferDecoderthat supports all MIME types.booleancanDecode(ResolvableType elementType, MimeType mimeType) Whether the decoder supports the given target element type and the MIME type of the source stream.protected CharBufferdecodeInternal(DataBuffer dataBuffer, Charset charset) Template method that decodes the given data buffer intoT, given the charset.static CharBufferDecoderCreate aCharBufferDecoderfor"text/plain".static CharBufferDecodertextPlainOnly(List<String> delimiters, boolean stripDelimiter) Create aCharBufferDecoderfor"text/plain".Methods inherited from class org.springframework.core.codec.AbstractCharSequenceDecoderdecode, decode, getDefaultCharset, setDefaultCharsetMethods inherited from class org.springframework.core.codec.AbstractDataBufferDecoderdecodeDataBuffer, decodeToMono, getMaxInMemorySize, setMaxInMemorySizeMethods inherited from class org.springframework.core.codec.AbstractDecodergetDecodableMimeTypes, getLogger, setLoggerMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.codec.DecodergetDecodableMimeTypes
- 
Constructor Details- 
CharBufferDecoder
 
- 
- 
Method Details- 
canDecodeDescription copied from interface:DecoderWhether the decoder supports the given target element type and the MIME type of the source stream.- Specified by:
- canDecodein interface- Decoder<CharBuffer>
- Overrides:
- canDecodein class- AbstractDecoder<CharBuffer>
- Parameters:
- elementType- the target element type for the output stream
- mimeType- the mime type associated with the stream to decode (can be- nullif not specified)
- Returns:
- trueif supported,- falseotherwise
 
- 
decodeInternalDescription copied from class:AbstractCharSequenceDecoderTemplate method that decodes the given data buffer intoT, given the charset.- Specified by:
- decodeInternalin class- AbstractCharSequenceDecoder<CharBuffer>
 
- 
textPlainOnlyCreate aCharBufferDecoderfor"text/plain".
- 
textPlainOnlyCreate aCharBufferDecoderfor"text/plain".- Parameters:
- delimiters- delimiter strings to use to split the input stream
- stripDelimiter- whether to remove delimiters from the resulting input strings
 
- 
allMimeTypesCreate aCharBufferDecoderthat supports all MIME types.
- 
allMimeTypesCreate aCharBufferDecoderthat supports all MIME types.- Parameters:
- delimiters- delimiter strings to use to split the input stream
- stripDelimiter- whether to remove delimiters from the resulting input strings
 
 
-