Class AbstractZipTransformer

All Implemented Interfaces:
Aware, BeanFactoryAware, BeanNameAware, InitializingBean, ApplicationContextAware, ComponentSourceAware, ExpressionCapable, GenericTransformer<Message<?>,Message<?>>, NamedComponent, Transformer
Direct Known Subclasses:
UnZipTransformer, ZipTransformer

public abstract class AbstractZipTransformer extends AbstractTransformer
Base class for transformers that provide Zip compression.
Since:
6.1
Author:
Gunnar Hillert, Artem Bilan
  • Field Details

    • charset

      protected Charset charset
    • zipResultType

      protected ZipResultType zipResultType
    • workDirectory

      protected File workDirectory
    • deleteFiles

      protected boolean deleteFiles
  • Constructor Details

    • AbstractZipTransformer

      public AbstractZipTransformer()
  • Method Details

    • setDeleteFiles

      public void setDeleteFiles(boolean deleteFiles)
      If the payload is an instance of File, this property specifies whether to delete the File after transformation. Default is false.
      Parameters:
      deleteFiles - Defaults to false if not set
    • setWorkDirectory

      public void setWorkDirectory(File workDirectory)
      Set the work-directory. The work directory is used when the ZipResultType is set to ZipResultType.FILE. By default, this property is set to the System temporary directory containing a subdirectory "ziptransformer".
      Parameters:
      workDirectory - Must not be null and must not represent a file.
    • setZipResultType

      public void setZipResultType(ZipResultType zipResultType)
      Define the format of the data returned after transformation. Available options are:
      • File
      • Byte Array
      Defaults to ZipResultType.FILE.
      Parameters:
      zipResultType - Must not be null
    • onInit

      protected void onInit()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this for initialization logic.
      Overrides:
      onInit in class IntegrationObjectSupport
    • 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 and its payload must not be null.
      Returns:
      The result of the transformation.
    • doZipTransform

      protected abstract Object doZipTransform(Message<?> message)
      Subclasses must implement this method to provide the Zip transformation logic.
      Parameters:
      message - The message will never be null.
      Returns:
      The result of the Zip transformation.