public class ResourceEncoder extends AbstractSingleValueEncoder<Resource>
Resource
s.AbstractEncoder.FlushingStrategy
Modifier and Type | Field and Description |
---|---|
private int |
bufferSize |
static int |
DEFAULT_BUFFER_SIZE |
FLUSHING_STRATEGY_HINT
Constructor and Description |
---|
ResourceEncoder() |
ResourceEncoder(int bufferSize) |
Modifier and Type | Method and 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 <any> |
encode(Resource resource,
DataBufferFactory dataBufferFactory,
ResolvableType type,
MimeType mimeType,
java.util.Map<java.lang.String,java.lang.Object> hints)
Encode
T to an output DataBuffer stream. |
getEncodableMimeTypes
public static final int DEFAULT_BUFFER_SIZE
private final int bufferSize
public ResourceEncoder()
public ResourceEncoder(int bufferSize)
public boolean canEncode(ResolvableType elementType, MimeType mimeType)
Encoder
canEncode
in interface Encoder<Resource>
canEncode
in class AbstractEncoder<Resource>
elementType
- the type of elements in the source streammimeType
- the MIME type for the output stream, can be null
if not specified.true
if supported, false
otherwiseprotected <any> encode(Resource resource, DataBufferFactory dataBufferFactory, ResolvableType type, MimeType mimeType, java.util.Map<java.lang.String,java.lang.Object> hints)
AbstractSingleValueEncoder
T
to an output DataBuffer
stream.encode
in interface Encoder<Resource>
encode
in class AbstractSingleValueEncoder<Resource>
resource
- 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