List of utility methods to do Unzip ZipFile
byte[] | unzip(byte[] zippedBytes) unzip int sChunk = 8192; ByteArrayInputStream in = new ByteArrayInputStream(zippedBytes); GZIPInputStream zipin = new GZIPInputStream(in); byte[] buffer = new byte[sChunk]; ByteArrayOutputStream out = new ByteArrayOutputStream(); int length; while ((length = zipin.read(buffer, 0, sChunk)) != -1) out.write(buffer, 0, length); ... |
boolean | unzip(File srcFile, File toDir) unzip return unzip(srcFile.toPath(), toDir.toPath());
|
void | unzip(final File zip, final File patchDir) unpack... try (final ZipFile zipFile = new ZipFile(zip)) { unzip(zipFile, patchDir); zipFile.close(); |
File | unzip(final File zipFile, final String suffix) unzip File ret = null; try (final FileInputStream fis = new FileInputStream(zipFile); final ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis))) { ZipEntry entry; while ((entry = zis.getNextEntry()) != null) { if (entry.getName().endsWith(suffix)) { ret = Files.createTempFile(entry.getName() + "-", suffix).toFile(); ret.deleteOnExit(); ... |
void | unzip(ZipEntry entry, ZipFile zipfile, File explodedDir) unzip if (entry.isDirectory()) { new File(explodedDir, entry.getName()).mkdirs(); return; File outputFile = new File(explodedDir, entry.getName()); if (!outputFile.getParentFile().exists()) { outputFile.getParentFile().mkdirs(); BufferedInputStream inputStream = new BufferedInputStream(zipfile.getInputStream(entry)); BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(outputFile)); try { ByteStreams.copy(inputStream, outputStream); } finally { outputStream.close(); inputStream.close(); |
void | unzip(ZipFile zip, File fileDir) Unzips a zipfile to a destination directory. for (Enumeration<? extends ZipEntry> en = zip.entries(); en.hasMoreElements();) { ZipEntry ze = en.nextElement(); long size = ze.getSize(); String name = ze.getName(); File zeFile = new File(fileDir, name); if (name.charAt(name.length() - 1) == '/') { zeFile.mkdirs(); } else { ... |
void | unzip(ZipFile zipFile, File dest) Unzip a zip file into a directory. Enumeration<? extends ZipEntry> entries = zipFile.entries(); if (dest.exists() && dest.isDirectory()) { while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); if (!entry.isDirectory()) { File destFile = new File(dest, entry.getName()); createFileWithPath(destFile); InputStream in = new BufferedInputStream(zipFile.getInputStream(entry)); ... |
void | unzip(ZipFile zipFile, File destDir) Unzip. Enumeration entries; try { entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); if (!entry.isDirectory()) { File destFile = new File(destDir, entry.getName()); File destFileDir = destFile.getParentFile(); ... |
void | unzip(ZipFile zipFile, File destDirectory) Unzips a zipFile to the specified directory. if (!destDirectory.exists()) { destDirectory.mkdir(); } else { if (!destDirectory.isDirectory()) { throw new Exception("The destDirectory file already exists and is not a directory"); Enumeration enumer = zipFile.entries(); ... |
void | unzip(ZipFile zipFile, File dstDir) Unzips the given zip file to the given destination directory extracting only those entries the pass through the given filter. unzip(zipFile, dstDir, dstDir, 0); |