Class ResourceEncoder
java.lang.Object
org.springframework.core.codec.AbstractEncoder<Resource>
org.springframework.core.codec.AbstractSingleValueEncoder<Resource>
org.springframework.core.codec.ResourceEncoder
Encoder for 
Resources.- Since:
- 5.0
- Author:
- Arjen Poutsma
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intThe default buffer size used by the encoder.Fields inherited from class org.springframework.core.codec.AbstractEncoderlogger
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionbooleancanEncode(ResolvableType elementType, @Nullable MimeType mimeType) Whether the encoder supports the given source element type and the MIME type for the output stream.protected reactor.core.publisher.Flux<DataBuffer> encode(Resource resource, DataBufferFactory bufferFactory, ResolvableType type, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) EncodeTto an outputDataBufferstream.Methods inherited from class org.springframework.core.codec.AbstractSingleValueEncoderencodeMethods inherited from class org.springframework.core.codec.AbstractEncodergetEncodableMimeTypes, getLogger, setLoggerMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.codec.EncoderencodeValue, getEncodableMimeTypes
- 
Field Details- 
DEFAULT_BUFFER_SIZEpublic static final int DEFAULT_BUFFER_SIZEThe default buffer size used by the encoder.- See Also:
 
 
- 
- 
Constructor Details- 
ResourceEncoderpublic ResourceEncoder()
- 
ResourceEncoderpublic ResourceEncoder(int bufferSize) 
 
- 
- 
Method Details- 
canEncodeDescription copied from interface:EncoderWhether the encoder supports the given source element type and the MIME type for the output stream.- Specified by:
- canEncodein interface- Encoder<Resource>
- Overrides:
- canEncodein class- AbstractEncoder<Resource>
- Parameters:
- elementType- the type of elements in the source stream
- mimeType- the MIME type for the output stream (can be- nullif not specified)
- Returns:
- trueif supported,- falseotherwise
 
- 
encodeprotected reactor.core.publisher.Flux<DataBuffer> encode(Resource resource, DataBufferFactory bufferFactory, ResolvableType type, @Nullable MimeType mimeType, @Nullable Map<String, Object> hints) Description copied from class:AbstractSingleValueEncoderEncodeTto an outputDataBufferstream.- Specified by:
- encodein class- AbstractSingleValueEncoder<Resource>
- Parameters:
- resource- the value to process
- bufferFactory- a buffer factory used to create the output
- type- the stream element type to process
- mimeType- the mime type to process
- hints- additional information about how to do decode, optional
- Returns:
- the output stream
 
 
-