public final class CommonsCompressAction extends AbstractAction
| Modifier and Type | Field and Description |
|---|---|
private static int |
BUF_SIZE |
private boolean |
deleteSource
If true, attempt to delete file on completion.
|
private java.io.File |
destination
Destination file.
|
private java.lang.String |
name
Compressor name.
|
private java.io.File |
source
Source file.
|
LOGGER| Constructor and Description |
|---|
CommonsCompressAction(java.lang.String name,
java.io.File source,
java.io.File destination,
boolean deleteSource)
Creates new instance of Bzip2CompressAction.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
execute()
Compresses.
|
static boolean |
execute(java.lang.String name,
java.io.File source,
java.io.File destination,
boolean deleteSource)
Compresses a file.
|
java.io.File |
getDestination() |
java.lang.String |
getName() |
java.io.File |
getSource() |
boolean |
isDeleteSource() |
protected void |
reportException(java.lang.Exception ex)
Reports exception.
|
java.lang.String |
toString() |
close, isComplete, isInterrupted, runprivate static final int BUF_SIZE
private final java.lang.String name
private final java.io.File source
private final java.io.File destination
private final boolean deleteSource
public CommonsCompressAction(java.lang.String name,
java.io.File source,
java.io.File destination,
boolean deleteSource)
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.public boolean execute()
throws java.io.IOException
execute in interface Actionexecute in class AbstractActionjava.io.IOException - on IO exception.public static boolean execute(java.lang.String name,
java.io.File source,
java.io.File destination,
boolean deleteSource)
throws java.io.IOException
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.java.io.IOException - on IO exception.protected void reportException(java.lang.Exception ex)
reportException in class AbstractActionex - exception.public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String getName()
public java.io.File getSource()
public java.io.File getDestination()
public boolean isDeleteSource()