List of utility methods to do Unzip File
void | unzip(File zip, String folder, File into) unzip into.mkdirs(); ZipInputStream stream = new ZipInputStream(new FileInputStream(zip)); ZipEntry entry = stream.getNextEntry(); byte[] buffer = new byte[1024]; while (entry != null) { String path = entry.getName(); if (path.startsWith(folder)) { path = path.substring(folder.length(), path.length()); ... |
void | unZip(File zipf, String targetDir) un Zip ZipFile zfile = new ZipFile(zipf); Enumeration zList = zfile.entries(); ZipEntry ze = null; byte[] buf = new byte[1024]; while (zList.hasMoreElements()) { ze = (ZipEntry) zList.nextElement(); if (ze.isDirectory()) { File f = new File(String.format("%s/%s", targetDir, ze.getName())); ... |
void | unzip(File zipFile, File dest) unzip try { FileInputStream fis = new FileInputStream(zipFile); CheckedInputStream checksum = new CheckedInputStream(fis, new Adler32()); ZipInputStream zis = new ZipInputStream(new BufferedInputStream(checksum)); ZipEntry next = null; while ((next = zis.getNextEntry()) != null) { File currentFile = new File(dest, next.getName()); if (next.isDirectory()) { ... |
void | unzip(File zipFile, File destDir) Unzip an archive into the directory destDir. ZipInputStream zis = null; try { FileInputStream fis = new FileInputStream(zipFile); zis = new ZipInputStream(new BufferedInputStream(fis)); ZipEntry entry = zis.getNextEntry(); while (entry != null) { byte data[] = new byte[BUF_SIZE]; File newFile = new File(destDir, entry.getName()); ... |
void | unzip(File zipFile, File destDir) Unpacks a zip file to the target directory. ZipFile zip = new ZipFile(zipFile); try { Enumeration<?> en = zip.entries(); int bufSize = 8196; while (en.hasMoreElements()) { ZipEntry entry = (ZipEntry) en.nextElement(); File file = (destDir != null) ? new File(destDir, entry.getName()) : new File(entry.getName()); if (entry.isDirectory()) { ... |
void | unzip(File zipFile, File destDir) Unzip a zip file to a destination. unzip(zipFile, destDir, new byte[1024 * 32]); |
String | unzip(File zipFile, File destDir) unzip if (!isDirectoryWritable(destDir, true)) { return "unable to create writable directory: " + destDir; ZipFile zip = null; try { zip = new ZipFile(zipFile); Enumeration<? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) { ... |
void | unzip(File zipFile, File destDir) Unzips the InputStream to the given destination directory. int BUFFER = 2048; BufferedOutputStream dest = null; ZipFile zip = new ZipFile(zipFile); Enumeration<? extends ZipEntry> entries = zip.entries(); ZipEntry entry; while (entries.hasMoreElements()) { entry = entries.nextElement(); if (entry.isDirectory()) { ... |
void | unzip(File zipFile, File destination) unzip ZipFile zip = new ZipFile(zipFile); destination.mkdir(); Enumeration zipFileEntries = zip.entries(); while (zipFileEntries.hasMoreElements()) { ZipEntry entry = (ZipEntry) zipFileEntries.nextElement(); String currentEntry = entry.getName(); File destFile = new File(destination, currentEntry); File destinationParent = destFile.getParentFile(); ... |
void | unzip(File zipFile, File destination, IProgressMonitor monitor) Uzips the given zip into the specified destination monitor.beginTask("Unzip " + zipFile.getName(), (int) zipFile.length()); final int BUFFER_SIZE = 4096; ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(zipFile))); ZipEntry entry; while ((entry = zis.getNextEntry()) != null) { int count; byte data[] = new byte[BUFFER_SIZE]; File outFile = new File(destination, entry.getName()); ... |