public class StringDecoder extends AbstractDecoder<String>
String stream.
By default, this decoder will split the received DataBuffers
along newline characters (\r\n), but this can be changed by
passing false as a constructor argument.
CharSequenceEncoder| Modifier and Type | Field and Description |
|---|---|
static Charset |
DEFAULT_CHARSET |
| Constructor and Description |
|---|
StringDecoder()
Create a
StringDecoder that decodes a bytes stream to a String stream |
StringDecoder(boolean splitOnNewline)
Create a
StringDecoder that decodes a bytes stream to a String stream |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canDecode(ResolvableType elementType,
MimeType mimeType,
Object... hints)
Whether the decoder supports the given target element type and the MIME
type of the source stream.
|
reactor.core.publisher.Flux<String> |
decode(org.reactivestreams.Publisher<DataBuffer> inputStream,
ResolvableType elementType,
MimeType mimeType,
Object... hints)
Decode a
DataBuffer input stream into a Flux of T. |
reactor.core.publisher.Mono<String> |
decodeToMono(org.reactivestreams.Publisher<DataBuffer> inputStream,
ResolvableType elementType,
MimeType mimeType,
Object... hints)
Decode a
DataBuffer input stream into a Mono of T. |
getDecodableMimeTypespublic static final Charset DEFAULT_CHARSET
public StringDecoder()
StringDecoder that decodes a bytes stream to a String stream
By default, this decoder will split along new lines.
public StringDecoder(boolean splitOnNewline)
StringDecoder that decodes a bytes stream to a String streamsplitOnNewline - whether this decoder should split the received data buffers
along newline characterspublic boolean canDecode(ResolvableType elementType, MimeType mimeType, Object... hints)
DecodercanDecode in interface Decoder<String>canDecode in class AbstractDecoder<String>elementType - the target element type for the output streammimeType - the mime type associated with the stream to decodehints - additional information about how to do decode, optionaltrue if supported, false otherwisepublic reactor.core.publisher.Flux<String> decode(org.reactivestreams.Publisher<DataBuffer> inputStream, ResolvableType elementType, MimeType mimeType, Object... hints)
DecoderDataBuffer input stream into a Flux of T.inputStream - the DataBuffer input stream to decodeelementType - the expected type of elements in the output stream;
this type must have been previously passed to the Decoder.canDecode(org.springframework.core.ResolvableType, org.springframework.util.MimeType, java.lang.Object...)
method and it must have returned true.mimeType - the MIME type associated with the input stream, optionalhints - additional information about how to do decode, optionalpublic reactor.core.publisher.Mono<String> decodeToMono(org.reactivestreams.Publisher<DataBuffer> inputStream, ResolvableType elementType, MimeType mimeType, Object... hints)
DecoderDataBuffer input stream into a Mono of T.decodeToMono in interface Decoder<String>decodeToMono in class AbstractDecoder<String>inputStream - the DataBuffer input stream to decodeelementType - the expected type of elements in the output stream;
this type must have been previously passed to the Decoder.canDecode(org.springframework.core.ResolvableType, org.springframework.util.MimeType, java.lang.Object...)
method and it must have returned true.mimeType - the MIME type associated with the input stream, optionalhints - additional information about how to do decode, optional