Class ZipTransformer

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

public class ZipTransformer extends AbstractZipTransformer
Transformer implementation that applies a Zip transformation to the message payload. Keep in mind that Zip entry timestamps are recorded only to 2 second precision:

See also:

Since:
6.1
Author:
Gunnar Hillert, Artem Bilan
  • Constructor Details

    • ZipTransformer

      public ZipTransformer()
  • Method Details

    • setCompressionLevel

      public void setCompressionLevel(int compressionLevel)
      Set the compression level. Default is Deflater.DEFAULT_COMPRESSION.
      Parameters:
      compressionLevel - Must be an integer value from 0-9.
    • setUseFileAttributes

      public void setUseFileAttributes(boolean useFileAttributes)
      Specify whether the name of the file shall be used for the zip entry.
      Parameters:
      useFileAttributes - Defaults to true if not set explicitly
    • setFileNameGenerator

      public void setFileNameGenerator(FileNameGenerator fileNameGenerator)
      Set a FileNameGenerator for zip file base name: the .zip extension is added to this name. Unless it already comes with .zip extension. Defaults to the DefaultFileNameGenerator. The result of this generator is also used for zip entry(ies) if ZipHeaders.ZIP_ENTRY_FILE_NAME header is not provided in the request message.
      Parameters:
      fileNameGenerator - the FileNameGenerator to use.
      Since:
      6.4
    • onInit

      protected void onInit()
      Description copied from class: IntegrationObjectSupport
      Subclasses may implement this for initialization logic.
      Overrides:
      onInit in class AbstractZipTransformer
    • doZipTransform

      protected Object doZipTransform(Message<?> message)
      The payload may encompass the following types: When providing an Iterable, nested Iterables are not supported. However, payloads can be any of the other supported types.
      Specified by:
      doZipTransform in class AbstractZipTransformer
      Parameters:
      message - The message will never be null.
      Returns:
      The result of the Zip transformation.