Class GzCompressAction
java.lang.Object
org.apache.logging.log4j.core.appender.rolling.action.AbstractAction
org.apache.logging.log4j.core.appender.rolling.action.GzCompressAction
Compresses a file using GZ compression.
-
Field Summary
Fields inherited from class org.apache.logging.log4j.core.appender.rolling.action.AbstractAction
LOGGER -
Constructor Summary
ConstructorsConstructorDescriptionGzCompressAction(File source, File destination, boolean deleteSource) Deprecated.GzCompressAction(File source, File destination, boolean deleteSource, int compressionLevel) Create new instance of GzCompressAction. -
Method Summary
Modifier and TypeMethodDescriptionbooleanexecute()Compress.static booleanDeprecated.In favor ofexecute(File, File, boolean, int).static booleanCompress a file.booleanprotected voidCapture exception.toString()Methods inherited from class org.apache.logging.log4j.core.appender.rolling.action.AbstractAction
close, isComplete, isInterrupted, run
-
Constructor Details
-
GzCompressAction
Create 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.compressionLevel- Gzip deflater compression level.
-
GzCompressAction
Deprecated.Prefer the constructor with compression level.
-
-
Method Details
-
execute
Compress.- Specified by:
executein interfaceAction- Specified by:
executein classAbstractAction- Returns:
- true if successfully compressed.
- Throws:
IOException- on IO exception.
-
execute
@Deprecated public static boolean execute(File source, File destination, boolean deleteSource) throws IOException Deprecated.In favor ofexecute(File, File, boolean, int).Compress 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.- Returns:
- true if source file compressed.
- Throws:
IOException- on IO exception.
-
execute
public static boolean execute(File source, File destination, boolean deleteSource, int compressionLevel) throws IOException Compress 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.compressionLevel- Gzip deflater compression level.- Returns:
- true if source file compressed.
- Throws:
IOException- on IO exception.
-
reportException
Capture exception.- Overrides:
reportExceptionin classAbstractAction- Parameters:
ex- exception.
-
toString
-
getSource
-
getDestination
-
isDeleteSource
public boolean isDeleteSource()
-
GzCompressAction(File, File, boolean, int).