Package org.springframework.core.codec
Class AbstractSingleValueEncoder<T>
java.lang.Object
org.springframework.core.codec.AbstractEncoder<T>
org.springframework.core.codec.AbstractSingleValueEncoder<T>
- Type Parameters:
T
- the element type
- All Implemented Interfaces:
Encoder<T>
- Direct Known Subclasses:
Jaxb2XmlEncoder
,ResourceEncoder
Abstract base class for
Encoder
classes that can only deal with a single value.- Since:
- 5.0
- Author:
- Arjen Poutsma
-
Field Summary
Fields inherited from class org.springframework.core.codec.AbstractEncoder
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal reactor.core.publisher.Flux<DataBuffer>
encode
(Publisher<? extends T> inputStream, DataBufferFactory bufferFactory, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) Encode a stream of Objects of typeT
into aDataBuffer
output stream.protected abstract reactor.core.publisher.Flux<DataBuffer>
encode
(T t, DataBufferFactory dataBufferFactory, ResolvableType type, MimeType mimeType, Map<String, Object> hints) EncodeT
to an outputDataBuffer
stream.Methods inherited from class org.springframework.core.codec.AbstractEncoder
canEncode, getEncodableMimeTypes, getLogger, setLogger
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.core.codec.Encoder
encodeValue, getEncodableMimeTypes
-
Constructor Details
-
AbstractSingleValueEncoder
-
-
Method Details
-
encode
public final reactor.core.publisher.Flux<DataBuffer> encode(Publisher<? extends T> inputStream, DataBufferFactory bufferFactory, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) Description copied from interface:Encoder
Encode a stream of Objects of typeT
into aDataBuffer
output stream.- Parameters:
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 ofMono
should be used.bufferFactory
- for creating output streamDataBuffer
'selementType
- the expected type of elements in the input stream; this type must have been previously passed to theEncoder.canEncode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)
method and it must have returnedtrue
.mimeType
- the MIME type for the output content (optional)hints
- additional information about how to encode- Returns:
- the output stream
-
encode
protected abstract reactor.core.publisher.Flux<DataBuffer> encode(T t, DataBufferFactory dataBufferFactory, ResolvableType type, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) EncodeT
to an outputDataBuffer
stream.- Parameters:
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- Returns:
- the output stream
-