I've been trying to understand why my code doesnt work on a zip and it doesnt on another..
THIS zip unzips , and THIS zip doesnt
Here is the code I use:
String zipFile = Path + FileName;
FileInputStream fin = new FileInputStream(zipFile);
ZipInputStream zin = new ZipInputStream(fin);
ZipEntry ze = null;
while ((ze = zin.getNextEntry()) != null) {
UnzipCounter++;
if (ze.isDirectory()) {
dirChecker(ze.getName());
} else {
FileOutputStream fout = new FileOutputStream(Path
+ ze.getName());
while ((Unziplength = zin.read(Unzipbuffer)) > 0) {
fout.write(Unzipbuffer, 0, Unziplength);
}
zin.closeEntry();
fout.close();
}
}
zin.close();
Can anyone tell me why?
The zip doesnt work means that when it reaches the line "while ((ze = zin.getNextEntry()) != null) {".. ze is always null so it doesnt enter the loop so it doesnt extract anything.. I can open+unzip both files with WinRar..