Class StreamTransformer

All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, InitializingBean, ApplicationContextAware, ExpressionCapable, GenericTransformer<Message<?>,Message<?>>, NamedComponent, Transformer

public class StreamTransformer extends AbstractTransformer
Transforms an InputStream payload to a byte[] or String (if a charset is provided).
Since:
4.3
Author:
Gary Russell
  • Constructor Details

    • StreamTransformer

      public StreamTransformer()
      Construct an instance to transform an InputStream to a byte[].
    • StreamTransformer

      public StreamTransformer(String charset)
      Construct an instance with the charset to convert the stream to a String; if null a byte[] will be produced instead.
      Parameters:
      charset - the charset.
  • Method Details

    • doTransform

      protected Object doTransform(Message<?> message)
      Description copied from class: AbstractTransformer
      Subclasses must implement this method to provide the transformation logic. If the return value is itself a Message, it will be used as the result. Otherwise, any non-null return value will be used as the payload of the result Message.
      Specified by:
      doTransform in class AbstractTransformer
      Parameters:
      message - The message.
      Returns:
      The result of the transformation.