解壓縮我設法透過這個簡單的代碼在java中的zip文件:成功創建文件無法通過標準的壓縮工具
BufferedInputStream origin = null;
FileOutputStream dest = new FileOutputStream(zipFile);
ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(dest));
out.setMethod(ZipOutputStream.DEFLATED);
out.setLevel(5);
byte data[] = new byte[BUFFER];
FileInputStream fi = new FileInputStream(file);
origin = new BufferedInputStream(fi, BUFFER);
ZipEntry entry = new ZipEntry(file.getName());
out.putNextEntry(entry);
int count;
while ((count = origin.read(data, 0, BUFFER)) != -1) {
out.write(data, 0, count);
}
out.closeEntry();
origin.close();
out.close();
zip文件。然而,當我試圖把它解壓使用WinZip或其他一些工具,我得到一個錯誤:
Central and local directory mismatch for file "my_file" (general
purpose flags - local:808 hex central: 8 hex).
Severe Error: Local and central GPFlags values don't match.
什麼是真正奇怪的,WinRAR和內部Win7的拉鍊,當我解壓縮文件沒有顯示出任何錯誤。
我在做什麼錯?有人有這個問題嗎? 非常感謝!
發現相關的問題,我也是在Android 2.3的用java:http://stackoverflow.com/questions/7407695/android-2-3-zip-problems-with-general-purpose-flags – vitalnik