if (Debug.debugging("zip")) {
Debug.output(" unzipping " + zipFileName);
}
ZipInputStream zin = new ZipInputStream(in);
ZipEntry e;
while ((e = zin.getNextEntry()) != null) {
if (e.isDirectory()) {
new File(toDir, e.getName()).mkdirs();
} else {
if (Debug.debugging("zip")) {
Debug.output(" unzipping " + e.getName());
}
unzip(zin, new File(toDir, e.getName()));
}
}
zin.close();
if (deleteAfter) {
if (Debug.debugging("zip")) {
Debug.output("unzipping complete, deleting zip file");
}
File file = new File(zipurl.getFile());
if (file.exists()) {
file.delete();
}
} else if (Debug.debugging("zip")) {
Debug.output("unzipping complete, leaving zip file");
}
return;
}
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}