我無法解壓縮大文件(50 MB)。我試過ZipInputStream
和ZipFile
。Android:打開大型壓縮文件
我收到以下異常,當我使用ZipFile
:
java.util.zip.ZipException: EOCD not found; not a Zip archive?
當我使用ZipInputStream
我得到的跟隨誤差:
there is no zip entry(zin.getNextEntry())
ZipInputStream
代碼:
public static void unzip(File _zipFile, File directory) throws IOException {
try {
FileInputStream fin = new FileInputStream(_zipFile);
ZipInputStream zin = new ZipInputStream(fin);
ZipEntry ze = null;
while ((ze = zin.getNextEntry()) != null) {
// not getting here
}
zin.close();
}
catch (Exception e) {
}
}
ZipFile
代碼:
public static void unzipa(File zipfile, File directory) throws IOException {
try {
ZipFile zfile = new ZipFile(zipfile); // getting exception here
Enumeration<? extends ZipEntry> entries = zfile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();
}
zfile.close();
}
catch (Exception ex) {
ErroHandling.HandleError(ex);
}
}
可能重複卡爾很慢。我如何優化性能?](http://stackoverflow.com/questions/3975847/extrakting-zip-to-sd-card-is-very-slow-how-can-i-optimize-performance) – TheIT 2015-02-28 18:55:20