Class ZipTransformer
java.lang.Object
org.springframework.integration.context.IntegrationObjectSupport
org.springframework.integration.transformer.AbstractTransformer
org.springframework.integration.zip.transformer.AbstractZipTransformer
org.springframework.integration.zip.transformer.ZipTransformer
- All Implemented Interfaces:
Aware
,BeanFactoryAware
,BeanNameAware
,InitializingBean
,ApplicationContextAware
,ComponentSourceAware
,ExpressionCapable
,GenericTransformer<Message<?>,
,Message<?>> NamedComponent
,Transformer
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:
- Since:
- 6.1
- Author:
- Gunnar Hillert, Artem Bilan
-
Field Summary
Fields inherited from class org.springframework.integration.zip.transformer.AbstractZipTransformer
charset, deleteFiles, workDirectory, zipResultType
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
EXPRESSION_PARSER, logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Object
doZipTransform
(Message<?> message) protected void
onInit()
Subclasses may implement this for initialization logic.void
setCompressionLevel
(int compressionLevel) Set the compression level.void
setFileNameGenerator
(FileNameGenerator fileNameGenerator) Set aFileNameGenerator
for zip file base name: the.zip
extension is added to this name.void
setUseFileAttributes
(boolean useFileAttributes) Specify whether the name of the file shall be used for the zip entry.Methods inherited from class org.springframework.integration.zip.transformer.AbstractZipTransformer
doTransform, setDeleteFiles, setWorkDirectory, setZipResultType
Methods inherited from class org.springframework.integration.transformer.AbstractTransformer
transform
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentDescription, getComponentName, getComponentSource, getComponentType, getConversionService, getExpression, getIntegrationProperties, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentDescription, setComponentName, setComponentSource, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
-
Constructor Details
-
ZipTransformer
public ZipTransformer()
-
-
Method Details
-
setCompressionLevel
public void setCompressionLevel(int compressionLevel) Set the compression level. Default isDeflater.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
Set aFileNameGenerator
for zip file base name: the.zip
extension is added to this name. Unless it already comes with.zip
extension. Defaults to theDefaultFileNameGenerator
. The result of this generator is also used for zip entry(ies) ifZipHeaders.ZIP_ENTRY_FILE_NAME
header is not provided in the request message.- Parameters:
fileNameGenerator
- theFileNameGenerator
to use.- Since:
- 6.4
-
onInit
protected void onInit()Description copied from class:IntegrationObjectSupport
Subclasses may implement this for initialization logic.- Overrides:
onInit
in classAbstractZipTransformer
-
doZipTransform
The payload may encompass the following types: When providing anIterable
, nested Iterables are not supported. However, payloads can be any of the other supported types.- Specified by:
doZipTransform
in classAbstractZipTransformer
- Parameters:
message
- The message will never be null.- Returns:
- The result of the Zip transformation.
-