public abstract class AbstractSingleValueEncoder<T> extends AbstractEncoder<T>
Encoder
classes that can only deal with a single value.Constructor and Description |
---|
AbstractSingleValueEncoder(MimeType... supportedMimeTypes) |
Modifier and Type | Method and Description |
---|---|
<any> |
encode(<any> inputStream,
DataBufferFactory bufferFactory,
ResolvableType elementType,
MimeType mimeType,
java.util.Map<java.lang.String,java.lang.Object> hints)
Encode a stream of Objects of type
T into a DataBuffer
output stream. |
protected abstract <any> |
encode(T t,
DataBufferFactory dataBufferFactory,
ResolvableType type,
MimeType mimeType,
java.util.Map<java.lang.String,java.lang.Object> hints)
Encode
T to an output DataBuffer stream. |
canEncode, getEncodableMimeTypes
public AbstractSingleValueEncoder(MimeType... supportedMimeTypes)
public final <any> encode(<any> inputStream, DataBufferFactory bufferFactory, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable java.util.Map<java.lang.String,java.lang.Object> hints)
Encoder
T
into a DataBuffer
output stream.inputStream
- 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
- for creating output stream DataBuffer
'selementType
- the expected type of elements in the input stream;
this type must have been previously passed to the Encoder.canEncode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)
method and it must have returned true
.mimeType
- the MIME type for the output stream (optional)hints
- additional information about how to do encodeprotected abstract <any> encode(T t, DataBufferFactory dataBufferFactory, ResolvableType type, @Nullable MimeType mimeType, @Nullable java.util.Map<java.lang.String,java.lang.Object> hints)
T
to an output DataBuffer
stream.t
- the value to processdataBufferFactory
- a buffer factory used to create the outputtype
- the stream element type to processmimeType
- the mime type to processhints
- Additional information about how to do decode, optional