我正在尝试解压缩存档,
zis.getNextEntry()
给我nextEntry
,我可以看到条目的正确名称,但 zip 输入流本身是空的。为什么?
byte[] htmlFile = new byte[]{};
ByteArrayInputStream bais = new ByteArrayInputStream(Base64.decodeBase64(template.getKey().getFileBase64()));
zis = new ZipInputStream(bais);
ZipEntry ze = null;
try {
while ((ze = zis.getNextEntry()) != null) {
if (!ze.isDirectory()) {
byte[] tempEntry = new byte[]{};
try {
zis.read(tempEntry);
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
try {
zis.closeEntry();
zis.close();
} catch (IOException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
下面是一些调试信息,您可以在其中看到 - 条目存在,但没有从流中读取: