List of utility methods to do Unzip ZipEntry
void | unzipEntry(ZipFile zipFile, ZipEntry entry, File entryTarget) unzip Entry if (entry.isDirectory()) { forceMkdir(entryTarget); } else { InputStream is = zipFile.getInputStream(entry); copyInputStreamToFile(is, entryTarget, false); |
void | unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDir) unzip Entry File outputFile = new File(outputDir, entry.getName()); if (entry.isDirectory()) { outputFile.mkdirs(); return; if (!outputFile.getParentFile().exists()) { outputFile.getParentFile().mkdirs(); BufferedInputStream inputStream = new BufferedInputStream(zipfile.getInputStream(entry)); BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(outputFile)); try { byte[] buf = new byte[1024 * 1024]; int k; while ((k = inputStream.read(buf)) != -1) { outputStream.write(buf, 0, k); outputStream.flush(); } finally { try { outputStream.close(); } catch (Exception e) { e.printStackTrace(); try { inputStream.close(); } catch (Exception e) { e.printStackTrace(); |
void | unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDir) unzip Entry if (entry.isDirectory()) { createDir(new File(outputDir, entry.getName())); return; File outputFile = new File(outputDir, entry.getName()); if (!outputFile.getParentFile().exists()) { createDir(outputFile.getParentFile()); BufferedInputStream inputStream = new BufferedInputStream(zipfile.getInputStream(entry)); BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(outputFile)); try { copy(inputStream, outputStream); } finally { outputStream.close(); inputStream.close(); |
void | unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDirectory) unzip Entry if (entry.isDirectory()) { createDirectory(new File(outputDirectory, entry.getName())); return; File outputFile = new File(outputDirectory, entry.getName()); if (!outputFile.getParentFile().exists()) { createDirectory(outputFile.getParentFile()); BufferedInputStream inputStream = null; BufferedOutputStream outputStream = null; try { inputStream = new BufferedInputStream(zipfile.getInputStream(entry)); outputStream = new BufferedOutputStream(new FileOutputStream(outputFile)); copy(inputStream, outputStream, 1024); } catch (IOException ex) { } finally { try { outputStream.close(); } catch (Exception ex) { try { inputStream.close(); } catch (Exception ex) { outputFile.setExecutable(true); outputFile.setReadable(true); outputFile.setWritable(true); |
void | unzipEntry(ZipInputStream zin, File f) unzip Entry FileOutputStream out = new FileOutputStream(f); byte[] b = new byte[512]; int len = 0; while ((len = zin.read(b)) != -1) { out.write(b, 0, len); out.flush(); out.close(); ... |
void | unzipEntry(ZipInputStream zis, File newFile) Unzip the given entry (a single file stored in the zip file) byte[] buffer = new byte[1024]; FileOutputStream fos = new FileOutputStream(newFile); int len; while ((len = zis.read(buffer)) > 0) { fos.write(buffer, 0, len); fos.close(); |
void | unzipEntry(ZipInputStream zis, File out) unzip Entry FileOutputStream fos = null; BufferedOutputStream bos = null; try { fos = new FileOutputStream(out); bos = new BufferedOutputStream(fos); byte[] buffer = new byte[16384]; int readBytes = 0; while ((readBytes = zis.read(buffer)) != -1) ... |
File | unzipEntry(ZipInputStream zis, File targetFile) unzip Entry FileOutputStream fos = null; try { fos = new FileOutputStream(targetFile); byte[] buffer = new byte[BUFFER_SIZE]; int len = 0; while ((len = zis.read(buffer)) != -1) { fos.write(buffer, 0, len); } finally { if (fos != null) { fos.close(); return targetFile; |
File | unzipEntryToFolder(ZipEntry entry, InputStream zis, File destFolder) unzip Entry To Folder BufferedOutputStream dest; if (entry.isDirectory()) { File destFile = new File(destFolder, entry.getName()); destFile.mkdirs(); return destFile; } else { int count; byte data[] = new byte[BUFFER]; ... |
void | unZipFile(File destFile, ZipFile zipFile, ZipEntry entry) un Zip File InputStream inputStream; FileOutputStream fileOut; if (entry.isDirectory()) { destFile.mkdirs(); } else { File parent = destFile.getParentFile(); if (parent != null && !parent.exists()) { parent.mkdirs(); ... |