public class StringDecoder extends AbstractDecoder<String>
String
stream.
By default, this decoder will split the received DataBuffer
s
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)
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,
Map<String,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,
Map<String,Object> hints)
Decode a
DataBuffer input stream into a Mono of T . |
getDecodableMimeTypes
public 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)
Decoder
public reactor.core.publisher.Flux<String> decode(org.reactivestreams.Publisher<DataBuffer> inputStream, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)
Decoder
DataBuffer
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)
method and it must have returned true
.mimeType
- the MIME type associated with the input stream, optionalhints
- additional information about how to do encodepublic reactor.core.publisher.Mono<String> decodeToMono(org.reactivestreams.Publisher<DataBuffer> inputStream, ResolvableType elementType, MimeType mimeType, Map<String,Object> hints)
Decoder
DataBuffer
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)
method and it must have returned true
.mimeType
- the MIME type associated with the input stream, optionalhints
- additional information about how to do encode