Class CommonsCompressAction

  • All Implemented Interfaces:
    Runnable, Action

    public final class CommonsCompressAction
    extends AbstractAction
    Compresses a file using bzip2 compression.
    • Constructor Detail

      • CommonsCompressAction

        public CommonsCompressAction​(String name,
                                     File source,
                                     File destination,
                                     boolean deleteSource)
        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 Detail

      • 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.
      • getName

        public String getName()
      • getSource

        public File getSource()
      • getDestination

        public File getDestination()
      • isDeleteSource

        public boolean isDeleteSource()