List of usage examples for java.util.zip ZipFile entries
public Enumeration<? extends ZipEntry> entries()
From source file:io.apigee.buildTools.enterprise4g.utils.ZipUtils.java
public void unzipArchive(File archive, File outputDir) { try {//from w w w . jav a 2 s. c o m ZipFile zipfile = new ZipFile(archive); for (Enumeration e = zipfile.entries(); e.hasMoreElements();) { ZipEntry entry = (ZipEntry) e.nextElement(); unzipEntry(zipfile, entry, outputDir); } } catch (Exception e) { log.error("Error while extracting file " + archive, e); } }
From source file:com.dibsyhex.apkdissector.ZipReader.java
public void getZipEntries(String name) { try {/*from w w w . java 2s.co m*/ File file = new File(name); ZipFile zipFile = new ZipFile(file); Enumeration<? extends ZipEntry> enumeration = zipFile.entries(); System.out.println("Listing Entries in the apkfile"); response.displayLog("Listing Entries in the apkfile"); while (enumeration.hasMoreElements()) { Object key = enumeration.nextElement(); //String s=key.toString()+":"+zipFile.getEntry(key.toString()); String s = zipFile.getEntry(key.toString()).toString(); System.out.println(" " + s); response.displayLog(s); } zipFile.close(); } catch (Exception e) { System.out.println(e.toString()); response.displayError(e.toString()); } }
From source file:asciidoc.maven.plugin.tools.ZipHelper.java
public void unzipArchive(File archive, File outputDir) { try {//from w w w . ja v a 2 s.c o m ZipFile zipfile = new ZipFile(archive); for (Enumeration<? extends ZipEntry> e = zipfile.entries(); e.hasMoreElements();) { ZipEntry entry = (ZipEntry) e.nextElement(); unzipEntry(zipfile, entry, outputDir); } } catch (Exception e) { this.log.error("Error while extracting file " + archive, e); } }
From source file:org.ecoinformatics.seek.datasource.EcogridZippedDataCacheItem.java
/** * This method overwirtes the super class. It is specified to unzip a zip * file/*from w w w . j a v a 2s . c o m*/ * * @throws Exception */ public void unCompressCacheItem() throws Exception { if (unCompressedCacheItemDir != null) { log.debug("At unCompressCacheItem method in Zip ojbect"); ZipFile zipFile = new ZipFile(getAbsoluteFileName()); Enumeration enu = zipFile.entries(); // go though every zip entry byte[] array = new byte[300 * 1024]; while (enu.hasMoreElements()) { ZipEntry entry = (ZipEntry) enu.nextElement(); // write zipEntry to a local file in // Cachedir/unzip/mlocatFilename/ String name = entry.getName(); if (name != null) { log.debug("Zip entry name is " + name); File unzipFile = new File(unCompressedCacheItemDir, name); FileOutputStream fileWriter = new FileOutputStream(unzipFile); InputStream fileReader = zipFile.getInputStream(entry); int len; while ((len = fileReader.read(array)) >= 0) { fileWriter.write(array, 0, len); } fileReader.close(); fileWriter.close(); } } unCompressedFileList = unCompressedCacheItemDir.list(); } }
From source file:it.tidalwave.northernwind.importer.infoglue.ExportConverter.java
protected void addLibraries(final @Nonnull String zippedLibraryPath, final @Nonnull ZonedDateTime dateTime) throws IOException { final @Cleanup ZipFile zipFile = new ZipFile(zippedLibraryPath); final Enumeration enumeration = zipFile.entries(); while (enumeration.hasMoreElements()) { final ZipEntry zipEntry = (ZipEntry) enumeration.nextElement(); if (!zipEntry.isDirectory()) { // System.out.println("Unzipping: " + zipEntry.getName()); final @Cleanup InputStream is = new BufferedInputStream(zipFile.getInputStream(zipEntry)); ResourceManager.addCommand(new AddResourceCommand(dateTime, zipEntry.getName(), IOUtils.toByteArray(is), "Extracted from library")); }/* www .j a va 2 s.co m*/ } }
From source file:org.dhatim.classpath.Scanner.java
private void handleArchive(File file) throws IOException { if (filter.isIgnorable(file.getName())) { if (logger.isDebugEnabled()) { logger.debug("Ignoring archive: " + file); }/*from www. j av a 2 s. c o m*/ return; } if (logger.isDebugEnabled()) { logger.debug("Scanning archive: " + file.getAbsolutePath()); } ZipFile zip = new ZipFile(file); Enumeration<? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); String name = entry.getName(); filter.filter(name); } }
From source file:org.cloudfoundry.client.lib.archive.ZipApplicationArchive.java
private List<Entry> adaptZipEntries(ZipFile zipFile) { List<Entry> entries = new ArrayList<Entry>(); Enumeration<? extends ZipEntry> zipEntries = zipFile.entries(); while (zipEntries.hasMoreElements()) { entries.add(new EntryAdapter(zipEntries.nextElement())); }/*w ww . j av a2 s. com*/ return Collections.unmodifiableList(entries); }
From source file:org.eclipse.ecr.common.utils.ZipFileIterator.java
public ZipFileIterator(ZipFile zip, ZipEntryFilter filter) { this.zip = zip; this.filter = filter; entries = zip.entries(); initNextEntry();//w w w . j a v a 2 s . c om }
From source file:com.sqli.liferay.imex.util.xml.ZipUtils.java
public void unzipArchive(File archive, File outputDir) throws IOException { try {/*w w w. ja va 2s . com*/ ZipFile zipfile = new ZipFile(archive); for (Enumeration e = zipfile.entries(); e.hasMoreElements();) { ZipEntry entry = (ZipEntry) e.nextElement(); unzipEntry(zipfile, entry, outputDir); } } catch (Exception e) { throw new IOException("Error while extracting file " + archive, e); } }
From source file:asciidoc.maven.plugin.AbstractAsciiDocMojo.java
private void unzipArchive(File archive, File outputDir) { try {/*from w ww . ja v a2 s . c om*/ ZipFile zipfile = new ZipFile(archive); for (Enumeration<? extends ZipEntry> e = zipfile.entries(); e.hasMoreElements();) { ZipEntry entry = (ZipEntry) e.nextElement(); unzipEntry(zipfile, entry, outputDir); } } catch (Exception e) { getLog().error("Error while extracting file " + archive, e); } }