ZipInputStream.getNextEntry()____________获取压缩文件内下一个文件,如果当前位置是文件夹则从文件夹内获取
ZipFile.getInputStream(ZipEntry) __________获取压缩包内部文件的输入流
示例:
Workbook wb = null;
ZipFile zf = new ZipFile(url);
InputStream in = new BufferedInputStream(new FileInputStream(url));
ZipInputStream zin = new ZipInputStream(in);
ZipEntry ze;
while ((ze = zin.getNextEntry()) != null) {
String name = ze.getName();
if (ze.isDirectory()) {
}else if(name.substring(name.lastIndexOf(".")+1).equals("xlsx")) {
wb = new XSSFWorkbook(zf.getInputStream(ze));
}
}