Class ZipHelper


  • public final class ZipHelper
    extends java.lang.Object
    Various helpers for handling ZIP files.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void unzipStreamIntoDirectory​(java.io.InputStream zipFileStream, java.io.File unzipTargetDirectory)
      Unzips contents of a zip file under the target directory.
      • Methods inherited from class java.lang.Object

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

      • unzipStreamIntoDirectory

        public static void unzipStreamIntoDirectory​(java.io.InputStream zipFileStream,
                                                    java.io.File unzipTargetDirectory)
                                             throws java.io.IOException
        Unzips contents of a zip file under the target directory. Closes stream. The unzipped files keep their relative paths from the zip file. That is files from the root of the zip file will be put directly under target directory, etc.
        Parameters:
        zipFileStream - input stream of a ZIP file
        unzipTargetDirectory - a directory where zip contents are put
        Throws:
        java.lang.IllegalArgumentException - when any param is null.
        java.lang.IllegalStateException - when target file already exists.
        java.io.IOException - on file system error