我目前有以下代码,它使用ZipInputStream实例将 zip 文件解压缩到手机上的目标位置:
ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream(sourceZipFile));
ZipEntry zipEntry = null;
while ((zipEntry = zipInputStream.getNextEntry()) != null) {
File zipEntryFile = new File(targetFolder, zipEntry.getName());
// write contents of 'zipEntry' to 'zipEntryFile'
}
有谁知道在开始之前是否有可能(使用上面的设置或其他设置)获取(估计)要解压缩的文件或字节的总数,以便在解压缩进行时显示进度指示器?我认为ZipInputStream可能有一个getTotalEntries()
或类似的方法,但我找不到这样的东西。