T - the type of elements in the output streampublic interface Decoder<T>
DataBuffer input stream into an output stream
of elements of type <T>.| Modifier and Type | Method and Description |
|---|---|
boolean |
canDecode(ResolvableType elementType,
MimeType mimeType)
Whether the decoder supports the given target element type and the MIME
type of the source stream.
|
default T |
decode(DataBuffer buffer,
ResolvableType targetType,
MimeType mimeType,
Map<String,Object> hints)
Decode a data buffer to an Object of type T.
|
reactor.core.publisher.Flux<T> |
decode(Publisher<DataBuffer> inputStream,
ResolvableType elementType,
MimeType mimeType,
Map<String,Object> hints)
Decode a
DataBuffer input stream into a Flux of T. |
reactor.core.publisher.Mono<T> |
decodeToMono(Publisher<DataBuffer> inputStream,
ResolvableType elementType,
MimeType mimeType,
Map<String,Object> hints)
Decode a
DataBuffer input stream into a Mono of T. |
List<MimeType> |
getDecodableMimeTypes()
Return the list of MIME types supported by this Decoder.
|
default List<MimeType> |
getDecodableMimeTypes(ResolvableType targetType)
Return the list of MIME types supported by this Decoder for the given type
of element.
|
boolean canDecode(ResolvableType elementType, @Nullable MimeType mimeType)
elementType - the target element type for the output streammimeType - the mime type associated with the stream to decode
(can be null if not specified)true if supported, false otherwisereactor.core.publisher.Flux<T> decode(Publisher<DataBuffer> inputStream, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
DataBuffer input stream into a Flux of T.inputStream - the DataBuffer input stream to decodeelementType - the expected type of elements in the output stream;
this type must have been previously passed to the canDecode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)
method and it must have returned true.mimeType - the MIME type associated with the input stream (optional)hints - additional information about how to do decodereactor.core.publisher.Mono<T> decodeToMono(Publisher<DataBuffer> inputStream, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
DataBuffer input stream into a Mono of T.inputStream - the DataBuffer input stream to decodeelementType - the expected type of elements in the output stream;
this type must have been previously passed to the canDecode(org.springframework.core.ResolvableType, org.springframework.util.MimeType)
method and it must have returned true.mimeType - the MIME type associated with the input stream (optional)hints - additional information about how to do decode@Nullable default T decode(DataBuffer buffer, ResolvableType targetType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints) throws DecodingException
buffer - the DataBuffer to decodetargetType - the expected output typemimeType - the MIME type associated with the datahints - additional information about how to do decodenullDecodingExceptionList<MimeType> getDecodableMimeTypes()
canDecode(elementType, null). The list may also exclude MIME types
supported only for a specific element type. Alternatively, use
getDecodableMimeTypes(ResolvableType) for a more precise list.default List<MimeType> getDecodableMimeTypes(ResolvableType targetType)
getDecodableMimeTypes()
if the Decoder doesn't support the given element type or if it supports
it only for a subset of MIME types.targetType - the type of element to check for decoding