Class ZipCompressAction

  • All Implemented Interfaces:
    java.lang.Runnable, Action

    public final class ZipCompressAction
    extends AbstractAction
    Compresses a file using Zip compression.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int BUF_SIZE  
      private boolean deleteSource
      If true, attempts to delete file on completion.
      private java.io.File destination
      Destination file.
      private int level
      Compression level.
      private java.io.File source
      Source file.
      • Fields inherited from class org.apache.logging.log4j.core.appender.rolling.action.AbstractAction

        LOGGER
    • Constructor Summary

      Constructors 
      Constructor Description
      ZipCompressAction​(java.io.File source, java.io.File destination, boolean deleteSource, int level)
      Creates new instance of GzCompressAction.
    • Field Detail

      • source

        private final java.io.File source
        Source file.
      • destination

        private final java.io.File destination
        Destination file.
      • deleteSource

        private final boolean deleteSource
        If true, attempts to delete file on completion.
      • level

        private final int level
        Compression level.
    • Constructor Detail

      • ZipCompressAction

        public ZipCompressAction​(java.io.File source,
                                 java.io.File destination,
                                 boolean deleteSource,
                                 int level)
        Creates 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 java.io.IOException
        Compresses.
        Specified by:
        execute in interface Action
        Specified by:
        execute in class AbstractAction
        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,
                                      int level)
                               throws java.io.IOException
        Compresses 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:
        java.io.IOException - on IO exception.
      • reportException

        protected void reportException​(java.lang.Exception ex)
        Captures exception.
        Overrides:
        reportException in class AbstractAction
        Parameters:
        ex - exception.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getSource

        public java.io.File getSource()
      • getDestination

        public java.io.File getDestination()
      • isDeleteSource

        public boolean isDeleteSource()
      • getLevel

        public int getLevel()