Class ZipHelper


  • public abstract class ZipHelper
    extends java.lang.Object
    Utility class for manipulating zip archives.
    • Constructor Summary

      Constructors 
      Constructor Description
      ZipHelper()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void zip​(java.io.File file, java.io.OutputStream output)
      This method compresses the input file to zip format.
      static void zip​(java.io.File file, java.io.OutputStream output, boolean includeRoot)
      This method compresses the input file to zip format.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ZipHelper

        public ZipHelper()
    • Method Detail

      • zip

        public static void zip​(java.io.File file,
                               java.io.OutputStream output)
                        throws java.io.IOException
        This method compresses the input file to zip format. If the given file is a directory, it recursively packs the directory into the output. Not including given directory itself. If the given file is already zipped, simply copies it into the output.
        Parameters:
        file - file to be zipped
        output - stream where the output will be written
        Throws:
        java.io.IOException - if zip creation fails
      • zip

        public static void zip​(java.io.File file,
                               java.io.OutputStream output,
                               boolean includeRoot)
                        throws java.io.IOException
        This method compresses the input file to zip format. If the given file is a directory, it recursively packs the directory into the output. If the given file is already zipped, simply copies it into the output.
        Parameters:
        file - file to be zipped
        output - stream where the output will be written
        includeRoot - if root dir should be included
        Throws:
        java.io.IOException - if zip creation fails