...
| Code Block | ||
|---|---|---|
| ||
static final int TOOBIG = 0x6400000; // 100MB
// ...
// write the files to the disk, but only if file is not insanely big
if (entry.getSize() > TOOBIG) {
throw new RuntimeExceptionIllegalStateException("File to be unzipped is huge.");
}
if (entry.getSize() == -1) {
throw new RuntimeExceptionIllegalStateException("File to be unzipped might be huge.");
}
FileOutputStream fos = new FileOutputStream(entry.getName());
dest = new BufferedOutputStream(fos, BUFFER);
while ((count = zis.read(data, 0, BUFFER)) != -1) {
dest.write(data, 0, count);
}
|
...