我检查过java api文档,它表示getNextEntry()
读取下一个ZIP文件条目并将流定位在条目数据的开头。getNextEntry()是做什么的?
这是什么意思“读取下一个zip文件”?为什么“下一个”?
我有这样的一段代码,这是什么线ze = zin.getNextEntry()
点?
public void unzip() {
try {
FileInputStream fin = new FileInputStream(_zipFile);
ZipInputStream zin = new ZipInputStream(fin);
ZipEntry ze = null;
while ((ze = zin.getNextEntry()) != null) {
Log.v("Decompress", "Unzipping " + ze.getName());
if(ze.isDirectory()) {
_dirChecker(ze.getName());
} else {
FileOutputStream fout = new FileOutputStream(_location + ze.getName());
for (int c = zin.read(); c != -1; c = zin.read()) {
fout.write(c);
}
zin.closeEntry();
fout.close();
}
}
zin.close();
} catch(Exception e) {
Log.e("Decompress", "unzip", e);
}
}
你可以检查我的更新问题?为什么这个示例代码在开始时会放入'ze = zin.getNextEntry()'?所以它开始从zip中的第二个文件解压缩? – Jolin 2013-02-16 20:04:24