Package org.apache.log4j.rolling.helper
Class GZCompressAction
- java.lang.Object
-
- org.apache.log4j.rolling.helper.ActionBase
-
- org.apache.log4j.rolling.helper.GZCompressAction
-
- All Implemented Interfaces:
java.lang.Runnable
,Action
public final class GZCompressAction extends ActionBase
Compresses a file using GZ compression.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
deleteSource
If true, attempt to delete file on completion.private java.io.File
destination
Destination file.private java.io.File
source
Source file.
-
Constructor Summary
Constructors Constructor Description GZCompressAction(java.io.File source, java.io.File destination, boolean deleteSource)
Create new instance of GZCompressAction.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
execute()
Compress.static boolean
execute(java.io.File source, java.io.File destination, boolean deleteSource)
Compress a file.protected void
reportException(java.lang.Exception ex)
Capture exception.-
Methods inherited from class org.apache.log4j.rolling.helper.ActionBase
close, isComplete, run
-
-
-
-
Constructor Detail
-
GZCompressAction
public GZCompressAction(java.io.File source, java.io.File destination, boolean deleteSource)
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.
-
-
Method Detail
-
execute
public boolean execute() throws java.io.IOException
Compress.- Specified by:
execute
in interfaceAction
- Specified by:
execute
in classActionBase
- Returns:
- true if successfully compressed.
- Throws:
java.io.IOException
- on IO exception.
-
execute
public static boolean execute(java.io.File source, java.io.File destination, boolean deleteSource) throws java.io.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.- Returns:
- true if source file compressed.
- Throws:
java.io.IOException
- on IO exception.
-
reportException
protected void reportException(java.lang.Exception ex)
Capture exception.- Overrides:
reportException
in classActionBase
- Parameters:
ex
- exception.
-
-