MCPcopy Index your code
hub / github.com/benfry/processing4 / unzip

Method unzip

app/src/processing/app/Util.java:690–712  ·  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

688 * Ignores (does not extract) any __MACOSX files from macOS archives.
689 */
690 static public void unzip(File zipFile, File dest) throws IOException {
691 FileInputStream fis = new FileInputStream(zipFile);
692 CheckedInputStream checksum = new CheckedInputStream(fis, new Adler32());
693 ZipInputStream zis = new ZipInputStream(new BufferedInputStream(checksum));
694 ZipEntry entry;
695 while ((entry = zis.getNextEntry()) != null) {
696 final String name = entry.getName();
697 if (!name.startsWith(("__MACOSX"))) {
698 File currentFile = new File(dest, name);
699 if (entry.isDirectory()) {
700 currentFile.mkdirs();
701 } else {
702 File parentDir = currentFile.getParentFile();
703 // Sometimes the directory entries aren't already created
704 if (!parentDir.exists()) {
705 parentDir.mkdirs();
706 }
707 currentFile.createNewFile();
708 unzipEntry(zis, currentFile);
709 }
710 }
711 }
712 }
713
714
715 static protected void unzipEntry(ZipInputStream zin, File f) throws IOException {

Callers 2

openSketchBundleMethod · 0.95
installMethod · 0.95

Calls 2

unzipEntryMethod · 0.95
getNameMethod · 0.45

Tested by

no test coverage detected