org.apache.logging.log4j.core.appender.rolling.action
Class ZipCompressAction

java.lang.Object
  extended by org.apache.logging.log4j.core.appender.rolling.action.AbstractAction
      extended by org.apache.logging.log4j.core.appender.rolling.action.ZipCompressAction
All Implemented Interfaces:
Runnable, Action

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
ZipCompressAction(File source, File destination, boolean deleteSource, int level)
          Create new instance of GzCompressAction.
 
Method Summary
 boolean execute()
          Compress.
static boolean execute(File source, File destination, boolean deleteSource, int level)
          Compress a file.
protected  void reportException(Exception ex)
          Capture exception.
 String toString()
           
 
Methods inherited from class org.apache.logging.log4j.core.appender.rolling.action.AbstractAction
close, isComplete, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZipCompressAction

public ZipCompressAction(File source,
                         File destination,
                         boolean deleteSource,
                         int level)
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.
level - TODO
Method Detail

execute

public boolean execute()
                throws IOException
Compress.

Specified by:
execute in interface Action
Specified by:
execute in class AbstractAction
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
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.
level - the compression level
Returns:
true if source file compressed.
Throws:
IOException - on IO exception.

reportException

protected void reportException(Exception ex)
Capture exception.

Overrides:
reportException in class AbstractAction
Parameters:
ex - exception.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.