Top Description Fields Constructors Methods
org.springframework.core.codec

public abstract Class AbstractSingleValueEncoder<T>

extends AbstractEncoder<T>
Class Inheritance
Known Direct Subclasses
org.springframework.core.codec.ResourceEncoder
Type Parameters
<T>
the element type
Imports
java.util.Map, org.reactivestreams.Publisher, reactor.core.publisher.Flux, org.springframework.core.ResolvableType, org.springframework.core.io.buffer.DataBuffer, .DataBufferFactory, .DataBufferUtils, org.springframework.lang.Nullable, org.springframework.util.MimeType

Abstract base class for org.springframework.core.codec.Encoder classes that can only deal with a single value.
Author
Arjen Poutsma
Since
5.0

Field Summary

Inherited from org.springframework.core.codec.AbstractEncoder:
logger

Constructor Summary

AccessConstructor and Description
public
AbstractSingleValueEncoder(MimeType... supportedMimeTypes)

Method Summary

Modifier and TypeMethod and Description
public final Flux<DataBuffer>
encode(Publisher<? extends T>
the input stream of Objects to encode. If the input should be encoded as a single value rather than as a stream of elements, an instance of Mono should be used.
inputStream
,
DataBufferFactory
for creating output stream DataBuffer's
bufferFactory
,
ResolvableType
the expected type of elements in the input stream; this type must have been previously passed to the canEncode method and it must have returned true.
elementType
,
MimeType
the MIME type for the output content (optional)
mimeType
,
Map<String, Object>
additional information about how to encode
hints
)

Implements org.springframework.core.codec.Encoder.encode.

Encode a stream of Objects of type T into a DataBuffer output stream.

protected abstract Flux<DataBuffer>

Returns:

the output stream
encode
(T
the value to process
t
,
DataBufferFactory
a buffer factory used to create the output
dataBufferFactory
,
ResolvableType
the stream element type to process
type
,
MimeType
the mime type to process
mimeType
,
Map<String, Object>
additional information about how to do decode, optional
hints
)

Encode T to an output DataBuffer stream.

Inherited from org.springframework.core.codec.AbstractEncoder:
canEncodegetEncodableMimeTypesgetLoggersetLogger

Constructor Detail

AbstractSingleValueEncoderback to summary
public AbstractSingleValueEncoder(MimeType... supportedMimeTypes)

Method Detail

encodeback to summary
public final Flux<DataBuffer> encode(Publisher<? extends T> inputStream, DataBufferFactory bufferFactory, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints)

Implements org.springframework.core.codec.Encoder.encode.

Doc from org.springframework.core.codec.Encoder.encode.

Encode a stream of Objects of type T into a DataBuffer output stream.

Parameters
inputStream:Publisher<? extends T>

the input stream of Objects to encode. If the input should be encoded as a single value rather than as a stream of elements, an instance of Mono should be used.

bufferFactory:DataBufferFactory

for creating output stream DataBuffer's

elementType:ResolvableType

the expected type of elements in the input stream; this type must have been previously passed to the canEncode method and it must have returned true.

mimeType:MimeType

the MIME type for the output content (optional)

hints:Map<String, Object>

additional information about how to encode

Returns:Flux<DataBuffer>

the output stream

Annotations
@Override
encodeback to summary
protected abstract Flux<DataBuffer> encode(T t, DataBufferFactory dataBufferFactory, ResolvableType type, MimeType mimeType, Map<String, Object> hints)

Encode T to an output DataBuffer stream.

Parameters
t:T

the value to process

dataBufferFactory:DataBufferFactory

a buffer factory used to create the output

type:ResolvableType

the stream element type to process

mimeType:MimeType

the mime type to process

hints:Map<String, Object>

additional information about how to do decode, optional

Returns:Flux<DataBuffer>

the output stream