List of usage examples for java.util.zip ZipInputStream skip
public long skip(long n) throws IOException
From source file:com.redhat.plugin.eap6.EAP6DeploymentStructureMojo.java
private Document getDeploymentStructureFromArchive(File zipFile) throws Exception { getLog().debug("Read deployment-informations from archive <" + zipFile + ">"); ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile)); ZipEntry entry;// w w w . ja v a2s . co m Document doc = null; boolean done = false; while (!done && (entry = zis.getNextEntry()) != null) { String entryName = entry.getName().toLowerCase(); if (entryName.endsWith("meta-inf/" + JBOSS_SUBDEPLOYMENT) || entryName.endsWith("web-inf/" + JBOSS_SUBDEPLOYMENT)) { byte[] buf = IOUtils.toByteArray(zis); if (verbose) { getLog().debug(new String(buf, encoding)); } DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); // doc=factory.newDocumentBuilder().parse(new ByteArrayInputStream(buf),encoding); doc = factory.newDocumentBuilder().parse( new org.xml.sax.InputSource(new java.io.StringReader(new String(buf, encoding).trim()))); done = true; } else { if (entry.getCompressedSize() >= 0) { if (verbose) { getLog().debug("Skipping entry <" + entryName + "> to next entry for bytes:" + entry.getCompressedSize()); } zis.skip(entry.getCompressedSize()); } } } zis.close(); return doc; }