Hello,
That is very strange but, we have an app for compressing a folder into a zip. For making, we use the Java.Util.Zip API. Our zip file looks fine, we can unzip the files into another folder without problems, even we can open the file with Winzip or Winrar.
But, we had encountered problems with anothers win apps like "Recovery ToolBox", or another win app built with the "Dynazip.dll" library. This apps give us the next error.
"Bad Crc".
But if we unzip this "corrupt" file and we zip the content again, all work without errors.
[http://img297.imageshack.us/i/dibujoou.jpg/]
Our code (this function only zips a single file):
public static File zipFile(String sFile, String sNameFileIn, String sFileOut)
throws IOException {
File file = new File(sFile);
FileOutputStream out = new FileOutputStream(sFileOut);
FileInputStream fin = new FileInputStream(file);
byte[] fileContent = new byte[(int) file.length()];
fin.read(fileContent);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ZipOutputStream zout = new ZipOutputStream(bout);
ZipEntry zipEntry = new ZipEntry(sNameFileIn);
zout.putNextEntry(zipEntry);
zout.write(fileContent, 0, fileContent.length);
zout.closeEntry();
zout.finish();
zout.flush();
zout.close();
out.write(bout.toByteArray());
out.flush();
out.close();
File fich = new File(sFileOut);
fin.close();
return fich;
}
I try to calculate the crc number for my own without success... I don't know what's happening
Thanks in advance