Package org.springframework.core.codec
Class ResourceEncoder
- java.lang.Object
- org.springframework.core.codec.AbstractEncoder<T>
- org.springframework.core.codec.AbstractSingleValueEncoder<Resource>
- org.springframework.core.codec.ResourceEncoder
public class ResourceEncoder extends AbstractSingleValueEncoder<Resource>
Encoder forResources
.- Since:
- 5.0
- Author:
- Arjen Poutsma
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_BUFFER_SIZE
The default buffer size used by the encoder.Fields inherited from class org.springframework.core.codec.AbstractEncoder
logger
Constructor Summary
Constructors Constructor Description ResourceEncoder()
ResourceEncoder(int bufferSize)
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canEncode(ResolvableType elementType, 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, MimeType mimeType, Map<String,Object> hints)
EncodeT
to an outputDataBuffer
stream.Methods inherited from class org.springframework.core.codec.AbstractSingleValueEncoder
encode
Methods inherited from class org.springframework.core.codec.AbstractEncoder
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
Field Detail
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
The default buffer size used by the encoder.- See Also:
- Constant Field Values
Constructor Detail
ResourceEncoder
public ResourceEncoder()
ResourceEncoder
public ResourceEncoder(int bufferSize)
Method Detail
canEncode
public boolean canEncode(ResolvableType elementType, @Nullable MimeType mimeType)
Description copied from interface:Encoder
Whether the encoder supports the given source element type and the MIME type for the output stream.
encode
protected reactor.core.publisher.Flux<DataBuffer> encode(Resource resource, DataBufferFactory bufferFactory, ResolvableType type, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
Description copied from class:AbstractSingleValueEncoder
EncodeT
to an outputDataBuffer
stream.- Specified by:
encode
in classAbstractSingleValueEncoder<Resource>
- Parameters:
resource
- the value to processbufferFactory
- 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