Unzips the InputStream to the given destination directory.

@param is
@param destDir
@throws FileNotFoundException
@throws IOException
541104
public static void unzip(InputStream is, File destDir)
            throws FileNotFoundException, IOException {
        BufferedOutputStream dest = null;
        ZipInputStream zis = new ZipInputStream(new BufferedInputStream(is));
        ZipEntry entry;
        while ((entry = zis.getNextEntry()) != null) {
            //System.out.println("Extracting: " + entry);
            if (entry.isDirectory()) {
                // Otherwise, empty directories do not get created
                (new File(destDir, entry.getName())).mkdirs();
            } else {
                File f = new File(destDir, entry.getName());
                f.getParentFile().mkdirs();
                int count;
                byte data[] = new byte[BUFFER];
                // write the files to the disk
                FileOutputStream fos = new FileOutputStream(f);
                dest = new BufferedOutputStream(fos, BUFFER);
                while ((count = zis.read(data, 0, BUFFER)) != -1) {
                    dest.write(data, 0, count);
                }
                dest.flush();
                dest.close();
            }
        }
        zis.close();
    }
835025
private void stream(InputStream is, File destFile) throws IOException {
        try {
            startProgress();
            OutputStream os = new FileOutputStream(destFile);
            
            boolean finished = false;
            try {
                byte[] buf = new byte[1024 * 10];
                int read;
                while ((read = is.read(buf)) >= 0) {
                    os.write(buf, 0, read);
                    processedBytes += read;
                    logProgress();
                }
                
                os.flush();
                finished = true;
            } finally {
                os.close();
                if (!finished) {
                    destFile.delete();
                }
            }
        } finally {
            is.close();
            completeProgress();
        }
    }
1320245
public static File ungzip(File gzip, File toDir) throws IOException {
		toDir.mkdirs();
		File out = new File(toDir, gzip.getName());
		GZIPInputStream gin = null;
		FileOutputStream fout = null;
		try {
			FileInputStream fin = new FileInputStream(gzip);
			gin = new GZIPInputStream(fin);
			fout = new FileOutputStream(out);
			copy(gin, fout);
			gin.close();
			fout.close();
		} finally {
			closeQuietly(gin);
			closeQuietly(fout);
		}
		return out;
	}
450581
private static void processZipStream(File dir, InputStream inputStream) throws IOException
   {
      ZipInputStream zip = new ZipInputStream(inputStream);
      while (true)
      {
         ZipEntry entry = zip.getNextEntry();
         if (entry == null)
         {
            break;
         }

         File file = new File(dir, entry.getName());
         if (entry.isDirectory())
         {
            FileHelper.mkdirsQuietly(file);
            continue;
         }

         File parent = file.getParentFile();
         if (parent != null)
         {
            FileHelper.mkdirsQuietly(parent);
         }

         FileOutputStream fos = new FileOutputStream(file);
         byte[] bytes = new byte[1024];
         int length;
         while ((length = zip.read(bytes)) >= 0)
         {
            fos.write(bytes, 0, length);
         }
         fos.close();
      }
   }
596212
public static void uncompressDirectory(File srcZipPath, File dstDirPath) throws IOException
   {
      ZipInputStream in = new ZipInputStream(new FileInputStream(srcZipPath));
      ZipEntry entry = null;

      try
      {
         while ((entry = in.getNextEntry()) != null)
         {
            File dstFile = new File(dstDirPath, entry.getName());
            dstFile.getParentFile().mkdirs();

            if (entry.isDirectory())
            {
               dstFile.mkdirs();
            }
            else
            {
               OutputStream out = new FileOutputStream(dstFile);
               try
               {
                  transfer(in, out);
               }
               finally
               {
                  out.close();
               }
            }
         }
      }
      finally
      {
         if (in != null)
         {
            in.close();
         }
      }
   }
1267135
public function unzip($zipFile, $destinationDirectory, array $options = [])
    {
        $fs = $this->getFilesystem();
        $normalized = @realpath($zipFile);
        if ($normalized === false || !$fs->isFile($normalized)) {
            throw new Exception(t('Unable to find the ZIP file %s', $zipFile));
        }
        $zipFile = str_replace(DIRECTORY_SEPARATOR, '/', $normalized);
        $normalized = @realpath($destinationDirectory);
        if ($normalized === false || !$fs->isDirectory($normalized)) {
            throw new Exception(t('Unable to find the directory %s', $destinationDirectory));
        }
        if (!$fs->isWritable($normalized)) {
            throw new Exception(t('The directory "%s" is not writable', $destinationDirectory));
        }
        $destinationDirectory = str_replace(DIRECTORY_SEPARATOR, '/', $normalized);
        $options += [
            'skipCheck' => false,
        ];
        if ($this->mayUseNativeCommand('unzip')) {
            $this->unzipNative($zipFile, $destinationDirectory, $options);
        } else {
            $this->unzipPHP($zipFile, $destinationDirectory, $options);
        }
    }
625651
def _unzip_file(self, src_path, dest_path, filename):
        """"""
        self.logger.info("unzipping file...")

        # construct full path (including file name) for unzipping
        unzip_path = os.path.join(dest_path, filename)
        utils.ensure_directory_exists(unzip_path)

        # extract data
        with zipfile.ZipFile(src_path, "r") as z:
            z.extractall(unzip_path)

        return True
454638
public static void decompressChunks(InputStream inputStream, Path tempFileOut) throws IOException {
        try (BufferedWriter writer = Files.newBufferedWriter(tempFileOut)) {
            try (GZIPInputStream chunkZipper = new GZIPInputStream(inputStream);
                 InputStream in = new BufferedInputStream(chunkZipper);) {
                byte[] buffer = new byte[BYTES_BUFFER_SIZE];
                int len;
                while ((len = in.read(buffer)) > 0) {
                    byte[] writtenBytes = new byte[len];
                    getBytes(buffer, 0, len, writtenBytes, 0);
                    String val = new String(writtenBytes, StandardCharsets.UTF_8);
                    writer.write(val);
                }
            }
        }
    }
1357077
public static boolean copyFile(final File src, final File dest)
    throws FileNotFoundException, IOException {
        return copyFile(src, dest, -1, true);
    }
845818
public static function copyFile( $src, $dest )
    {
        // check source path
        if ( !$src->isFile() ){
            throw new NotFileException($src);
        }
        if ( !$src->isReadable() ){
            throw new FileIsNotReadableException($src);
        }

        // check destination path
        $dir = $dest->getParent();
        if ( !$dir->isDir() ){
            throw new NotDirectoryException($dir);
        }

        // do copy
        $result = @copy( $src->getPath(), $dest->getPath() );

        if ( false === $result ){
            throw new FileCopyException($src, $dest);
        }
    }
1209484
private void unzip(final File file, final String outputDir) throws IOException {

		try (final ZipFile zipFile = new ZipFile(file)) {

			final Enumeration<? extends ZipEntry> entries = zipFile.entries();

			while (entries.hasMoreElements()) {

				final ZipEntry entry = entries.nextElement();
				final File targetFile = new File(outputDir, entry.getName());

				if (entry.isDirectory()) {

					targetFile.mkdirs();

				} else {

					targetFile.getParentFile().mkdirs();
					InputStream in = zipFile.getInputStream(entry);

					try (OutputStream out = new FileOutputStream(targetFile)) {

						IOUtils.copy(in, out);
						IOUtils.closeQuietly(in);
					}
				}
			}
		}
	}
1352738
public static void unzip(Path zip, Path target) throws IOException {
        try (final ZipFile zipFile = new ZipFile(zip.toFile())){
            unzip(zipFile, target);
        }
    }
1018199
public static void unZip(File inFile, File unzipDir) throws IOException {
    Enumeration<? extends ZipEntry> entries;
    ZipFile zipFile = new ZipFile(inFile);

    try {
      entries = zipFile.entries();
      while (entries.hasMoreElements()) {
        ZipEntry entry = entries.nextElement();
        if (!entry.isDirectory()) {
          InputStream in = zipFile.getInputStream(entry);
          try {
            File file = new File(unzipDir, entry.getName());
            if (!file.getParentFile().mkdirs()) {
              if (!file.getParentFile().isDirectory()) {
                throw new IOException("Mkdirs failed to create " +
                                      file.getParentFile().toString());
              }
            }
            OutputStream out = new FileOutputStream(file);
            try {
              byte[] buffer = new byte[8192];
              int i;
              while ((i = in.read(buffer)) != -1) {
                out.write(buffer, 0, i);
              }
            } finally {
              out.close();
            }
          } finally {
            in.close();
          }
        }
      }
    } finally {
      zipFile.close();
    }
  }
368695
public static void removeEntries(File zip, String[] paths, File destZip) {
    if (log.isDebugEnabled()) {
      log.debug("Copying '" + zip + "' to '" + destZip + "' and removing paths " + Arrays.asList(paths) + ".");
    }

    ZipOutputStream out = null;
    try {
      out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(destZip)));
      copyEntries(zip, out, new HashSet<String>(Arrays.asList(paths)));
    }
    catch (IOException e) {
      throw ZipExceptionUtil.rethrow(e);
    }
    finally {
      IOUtils.closeQuietly(out);
    }
  }
1106726
public static boolean unzipFileIntoDirectory(final File zipFile, final String directory) {
        final Map<ZipEntry, byte[]> zipEntries = new HashMap<ZipEntry, byte[]>();
        ZipInputStream zis;
        try {
            zis = new ZipInputStream(new FileInputStream(zipFile));
        } catch (FileNotFoundException ex) {
            LOG.error("Unable to find specified file", ex);
            return false;
        }
        ZipEntry entry = null;
        byte[] buffer = new byte[1024];
        try {
            int read;
            while ((entry = zis.getNextEntry()) != null) {
                final ByteArrayOutputStream bos = new ByteArrayOutputStream();
                while ((read = zis.read(buffer)) > 0) {
                    bos.write(buffer, 0, read);
                }
                zipEntries.put(entry, bos.toByteArray());
            }
        } catch (IOException ex) {
            LOG.error("Unable to write ZIP file to directory", ex);
            return false;
        }
        return unzipFileIntoDirectory(zipEntries, directory);
    }
534537
@Deprecated
    public void copyFileEntry(String destDir, ZipFile zf, ZipEntry ze) throws IOException {
        //Delegation to preferred method
        copyFileEntry(new File(destDir), zf, ze);
    }
145839
public static void recursivelyDeleteDirectory(File directory) throws IOException {
    if (!directory.exists()) {
      return;
    }
    checkArgument(directory.isDirectory(), "Cannot recursively delete a non-directory");
    walkFileTree(directory.toPath(), new DeletionFileVisitor());
  }