Class CommonsCompressAction
java.lang.Object
org.apache.logging.log4j.core.appender.rolling.action.AbstractAction
org.apache.logging.log4j.core.appender.rolling.action.CommonsCompressAction
Compresses a file using bzip2 compression.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate final booleanIf true, attempt to delete file on completion.private final FileDestination file.private final StringCompressor name.private final FileSource file.Fields inherited from class AbstractAction
LOGGER -
Constructor Summary
ConstructorsConstructorDescriptionCommonsCompressAction(String name, File source, File destination, boolean deleteSource) Creates new instance of Bzip2CompressAction. -
Method Summary
Methods inherited from class AbstractAction
close, isComplete, isInterrupted, run
-
Field Details
-
BUF_SIZE
private static final int BUF_SIZE- See Also:
-
name
Compressor name. One of "gz", "bzip2", "xz", "pack200" or "deflate". -
source
Source file. -
destination
Destination file. -
deleteSource
private final boolean deleteSourceIf true, attempt to delete file on completion.
-
-
Constructor Details
-
CommonsCompressAction
Creates new instance of Bzip2CompressAction.- Parameters:
name- the compressor name. One of "gz", "bzip2", "xz", "pack200", or "deflate".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.
-
-
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(String name, File source, File destination, boolean deleteSource) throws IOException Compresses a file.- Parameters:
name- the compressor name, i.e. "gz", "bzip2", "xz", "pack200", or "deflate".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.
-
reportException
Reports exception.- Overrides:
reportExceptionin classAbstractAction- Parameters:
ex- exception.
-
toString
-
getName
-
getSource
-
getDestination
-
isDeleteSource
public boolean isDeleteSource()
-