我想提取一个普通的zip文件,但它保持失败。 这是我的代码,我现在使用:解压zip文件给出“java.util.zip.ZipException:无法读取版本”或“java.util.ZipException无法读取本地头版本45”
private File downloadPath = new File(Environment.getExternalStorageDirectory() + "/Test/file.zip");
private File unzipLoc = new File(Environment.getExternalStorageDirectory() + "/Test/");
FileInputStream fin = new FileInputStream(downloadPath);
ZipInputStream zin = new ZipInputStream(fin);
ZipEntry ze = null;
while ((ze = zin.getNextEntry()) != null)
{
FileOutputStream fout = new FileOutputStream(unzipLoc + ze.getName());
for (int c = zin.read(); c != -1; c = zin.read())
{
fout.write(c);
}
zin.closeEntry();
fout.close();
}
zin.close();
它未能在“zin.getNextEntry()”的一部分。 错误:java.util.zip.ZipException:无法读取版本 任何想法?谢谢!
听起来像您的ZIP文件无效。 – SLaks