MCPcopy Index your code
hub / github.com/processing/processing / unzip

Method unzip

app/src/processing/app/Util.java:621–647  ·  view source on GitHub ↗

Extract the contents of a .zip archive into a folder. Ignores (does not extract) any __MACOSX files from macOS archives.

(File zipFile, File dest)

Source from the content-addressed store, hash-verified

619 * Ignores (does not extract) any __MACOSX files from macOS archives.
620 */
621 static public void unzip(File zipFile, File dest) {
622 try {
623 FileInputStream fis = new FileInputStream(zipFile);
624 CheckedInputStream checksum = new CheckedInputStream(fis, new Adler32());
625 ZipInputStream zis = new ZipInputStream(new BufferedInputStream(checksum));
626 ZipEntry entry = null;
627 while ((entry = zis.getNextEntry()) != null) {
628 final String name = entry.getName();
629 if (!name.startsWith(("__MACOSX"))) {
630 File currentFile = new File(dest, name);
631 if (entry.isDirectory()) {
632 currentFile.mkdirs();
633 } else {
634 File parentDir = currentFile.getParentFile();
635 // Sometimes the directory entries aren't already created
636 if (!parentDir.exists()) {
637 parentDir.mkdirs();
638 }
639 currentFile.createNewFile();
640 unzipEntry(zis, currentFile);
641 }
642 }
643 }
644 } catch (Exception e) {
645 e.printStackTrace();
646 }
647 }
648
649
650 static protected void unzipEntry(ZipInputStream zin, File f) throws IOException {

Callers 1

installMethod · 0.95

Calls 4

unzipEntryMethod · 0.95
startsWithMethod · 0.80
getNameMethod · 0.45
printStackTraceMethod · 0.45

Tested by

no test coverage detected