解压缩我设法透过这个简单的代码在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