List of usage examples for org.apache.poi.openxml4j.util ZipEntrySource getInputStream
InputStream getInputStream(ZipArchiveEntry entry) throws IOException;
From source file:org.apache.tika.parser.microsoft.ooxml.xps.XPSExtractorDecorator.java
License:Apache License
private static InputStream getZipStream(String zipPath, ZipPackage zipPackage) throws IOException, TikaException { String targPath = (zipPath.length() > 1 && zipPath.startsWith("/") ? zipPath.substring(1) : zipPath); ZipEntrySource zipEntrySource = zipPackage.getZipArchive(); Enumeration<? extends ZipEntry> zipEntryEnumeration = zipEntrySource.getEntries(); ZipEntry zipEntry = null;/*www . j a v a2 s. c om*/ while (zipEntryEnumeration.hasMoreElements()) { ZipEntry ze = zipEntryEnumeration.nextElement(); if (ze.getName().equals(targPath)) { zipEntry = ze; break; } } if (zipEntry == null) { throw new TikaException("Couldn't find required zip entry: " + zipPath); } return zipEntrySource.getInputStream(zipEntry); }