Class ResourceDecoder

All Implemented Interfaces:
Decoder<Resource>

public class ResourceDecoder extends AbstractDataBufferDecoder<Resource>
Decoder for Resources.
Since:
5.0
Author:
Arjen Poutsma, Rossen Stoyanchev
  • Field Details

    • FILENAME_HINT

      public static final String FILENAME_HINT
      Name of hint with a filename for the resource(for example, from "Content-Disposition" HTTP header).
  • Constructor Details

    • ResourceDecoder

      public ResourceDecoder()
  • Method Details

    • canDecode

      public boolean canDecode(ResolvableType elementType, @Nullable MimeType mimeType)
      Description copied from interface: Decoder
      Whether the decoder supports the given target element type and the MIME type of the source stream.
      Specified by:
      canDecode in interface Decoder<Resource>
      Overrides:
      canDecode in class AbstractDecoder<Resource>
      Parameters:
      elementType - the target element type for the output stream
      mimeType - the mime type associated with the stream to decode (can be null if not specified)
      Returns:
      true if supported, false otherwise
    • decode

      public reactor.core.publisher.Flux<Resource> decode(Publisher<DataBuffer> inputStream, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
      Description copied from interface: Decoder
      Decode a DataBuffer input stream into a Flux of T.
      Specified by:
      decode in interface Decoder<Resource>
      Overrides:
      decode in class AbstractDataBufferDecoder<Resource>
      Parameters:
      inputStream - the DataBuffer input stream to decode
      elementType - the expected type of elements in the output stream; this type must have been previously passed to the Decoder.canDecode(ResolvableType, 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
      Returns:
      the output stream with decoded elements
    • decode

      public Resource decode(DataBuffer dataBuffer, ResolvableType elementType, @Nullable MimeType mimeType, @Nullable Map<String,Object> hints)
      Description copied from interface: Decoder
      Decode a data buffer to an Object of type T. This is useful for scenarios, that distinct messages (or events) are decoded and handled individually, in fully aggregated form.
      Parameters:
      dataBuffer - the DataBuffer to decode
      elementType - the expected output type
      mimeType - the MIME type associated with the data
      hints - additional information about how to do decode
      Returns:
      the decoded value, possibly null