use of org.apache.poi.poifs.crypt.temp.AesZipFileZipEntrySource in project poi by apache.
the class LoadPasswordProtectedXlsxStreaming method printSheetCount.
public static void printSheetCount(final InputStream inputStream) throws Exception {
AesZipFileZipEntrySource source = AesZipFileZipEntrySource.createZipEntrySource(inputStream);
try {
OPCPackage pkg = OPCPackage.open(source);
try {
XSSFReader reader = new XSSFReader(pkg);
SheetIterator iter = (SheetIterator) reader.getSheetsData();
int count = 0;
while (iter.hasNext()) {
iter.next();
count++;
}
System.out.println("sheet count: " + count);
} finally {
IOUtils.closeQuietly(pkg);
}
} finally {
IOUtils.closeQuietly(source);
}
}
Aggregations