Trying to use Java zip package to zip a huge file (7.5 Gb) and it takes a full 9 minutes to zip it up but at the end when I load the zip with WinZip it reprots the file size as 3.5 Gb (uncompressed). What happened to the other half? If I try to extract it, winzip runs into an error.
However here's what is interesting, when I use WinZip to zip the file, it also takes the same time - 9 minutes, and produces a zip file of about the same size (730 megs) but it has no problem reporting the full size as 7.5 Gb when opened.
So what's the deal? It is as if Java's zip library went through the whole thing and compressed it but didnt put the right header information so WinZip doesn't know how to extract it?
my code atatched:
public void run() {
ZipOutputStream out = null;
try {
out = new ZipOutputStream(new FileOutputStream(zipFilename));
for (int i=0; i<filenames.length; i++) {
File f = new File(filenames);
byte[] buffer = new byte[1024 * 1024 * 100];
FileInputStream in = new FileInputStream(f);
out.putNextEntry(new ZipEntry(f.getName()));
int read;
while ( (read = in.read(buffer)) > 0) {
out.write(buffer, 0, read);
}
out.closeEntry();
in.close();
}
} catch (Throwable e) {
System.out.println("Error: "+e.getMessage());
} finally {
try { out.close(); } catch (Exception e) {}
}
}