/** * Extract the contents of a zipfile to a directory. * * @param zipFile * the zip file to extract * @param destDir * the destination directory * @throws IOException * when something untowards happens during the extraction process */ public static void extract(File zipFile, File destDir) throws IOException { ZipFile zf = new ZipFile(zipFile); try { extract(zf, destDir); } finally { zf.close(); } }
/** * Extract the contents of a zipfile to a directory. * * @param zipFile * the zip file to extract * @param destDir * the destination directory * @throws IOException * when something untowards happens during the extraction process */ public static void extract(ZipFile zipFile, File destDir) throws IOException { assert destDir.isDirectory(); Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); writeEntry(zipFile, entry, destDir); } }
JarFile jar = con.getJarFile(); ZipUtil.extract(jar, tmpDir);
JarFile jar = con.getJarFile(); ZipUtil.extract(jar, tmpDir);
JarFile jar = con.getJarFile(); ZipUtil.extract(jar, tmpDir);
JarFile jar = con.getJarFile(); ZipUtil.extract(jar, tmpDir);