T- the type of elements in the input stream
public interface Encoder<T>
<T>into an output stream of bytes.
|Modifier and Type||Method and Description|
Whether the encoder supports the given source element type and the MIME type for the output stream.
Encode a stream of Objects of type
this method was added so
Return the list of mime types this encoder supports.
boolean canEncode(ResolvableType elementType, @Nullable MimeType mimeType)
elementType- the type of elements in the source stream
mimeType- the MIME type for the output stream (can be
nullif not specified)
reactor.core.publisher.Flux<DataBuffer> encode(org.reactivestreams.Publisher<? extends T> inputStream, DataBufferFactory bufferFactory, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
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
Monoshould be used.
bufferFactory- for creating output stream
elementType- the expected type of elements in the input stream; this type must have been previously passed to the
canEncode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)method and it must have returned
mimeType- the MIME type for the output stream (optional)
hints- additional information about how to do encode
EncoderHttpMessageWritercan set the content-length header. However after further improvements as of 5.0.7, it is no longer needed, and not used.
t- the item to check
nullif not known.