Class ZipCompressAction
java.lang.Object
org.apache.logging.log4j.core.appender.rolling.action.AbstractAction
org.apache.logging.log4j.core.appender.rolling.action.ZipCompressAction
Compresses a file using Zip compression.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final booleanIf true, attempts to delete file on completion.private final FileDestination file.private final intCompression level.private final FileSource file.Fields inherited from class org.apache.logging.log4j.core.appender.rolling.action.AbstractAction
LOGGER -
Constructor Summary
ConstructorsConstructorDescriptionZipCompressAction(File source, File destination, boolean deleteSource, int level) Creates new instance of GzCompressAction. -
Method Summary
Methods inherited from class org.apache.logging.log4j.core.appender.rolling.action.AbstractAction
close, isComplete, isInterrupted, run
-
Field Details
-
BUF_SIZE
private static final int BUF_SIZE- See Also:
-
source
Source file. -
destination
Destination file. -
deleteSource
private final boolean deleteSourceIf true, attempts to delete file on completion. -
level
private final int levelCompression level.
-
-
Constructor Details
-
ZipCompressAction
Creates new instance of GzCompressAction.- Parameters:
source- file to compress, may not be null.destination- compressed file, may not be null.deleteSource- if true, attempt to delete file on completion. Failure to delete does not cause an exception to be thrown or affect return value.level- TODO
-
-
Method Details
-
execute
Compresses.- Specified by:
executein interfaceAction- Specified by:
executein classAbstractAction- Returns:
- true if successfully compressed.
- Throws:
IOException- on IO exception.
-
execute
public static boolean execute(File source, File destination, boolean deleteSource, int level) throws IOException Compresses a file.- Parameters:
source- file to compress, may not be null.destination- compressed file, may not be null.deleteSource- if true, attempt to delete file on completion. Failure to delete does not cause an exception to be thrown or affect return value.level- the compression level- Returns:
- true if source file compressed.
- Throws:
IOException- on IO exception.
-
reportException
Captures exception.- Overrides:
reportExceptionin classAbstractAction- Parameters:
ex- exception.
-
toString
-
getSource
-
getDestination
-
isDeleteSource
public boolean isDeleteSource() -
getLevel
public int getLevel()
-