List of usage examples for org.apache.poi.openxml4j.opc ZipPackage getZipArchive
public ZipEntrySource getZipArchive()
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;/*ww w . ja va 2 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); }