Class ZipCompressAction
- java.lang.Object
-
- org.apache.logging.log4j.core.appender.rolling.action.AbstractAction
-
- org.apache.logging.log4j.core.appender.rolling.action.ZipCompressAction
-
public final class ZipCompressAction extends AbstractAction
Compresses a file using Zip compression.
-
-
Field Summary
-
Fields inherited from class org.apache.logging.log4j.core.appender.rolling.action.AbstractAction
LOGGER
-
-
Constructor Summary
Constructors Constructor Description ZipCompressAction(File source, File destination, boolean deleteSource, int level)Creates new instance of GzCompressAction.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanexecute()Compresses.static booleanexecute(File source, File destination, boolean deleteSource, int level)Compresses a file.FilegetDestination()intgetLevel()FilegetSource()booleanisDeleteSource()protected voidreportException(Exception ex)Captures exception.StringtoString()-
Methods inherited from class org.apache.logging.log4j.core.appender.rolling.action.AbstractAction
close, isComplete, isInterrupted, run
-
-
-
-
Constructor Detail
-
ZipCompressAction
public ZipCompressAction(File source, File destination, boolean deleteSource, int level)
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 Detail
-
execute
public boolean execute() throws IOExceptionCompresses.- 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
protected void reportException(Exception ex)
Captures exception.- Overrides:
reportExceptionin classAbstractAction- Parameters:
ex- exception.
-
getSource
public File getSource()
-
getDestination
public File getDestination()
-
isDeleteSource
public boolean isDeleteSource()
-
getLevel
public int getLevel()
-
-