ZipFileIterator(final ZipFile in) { this.in = in; nestedEnum = in.getEntriesInPhysicalOrder(); } @Override
/** * Transfer selected entries from this zipfile to a given #ZipArchiveOutputStream. * Compression and all other attributes will be as in this file. * <p>This method transfers entries based on the central directory of the zip file.</p> * * @param target The zipArchiveOutputStream to write the entries to * @param predicate A predicate that selects which entries to write * @throws IOException on error */ public void copyRawEntries(final ZipArchiveOutputStream target, final ZipArchiveEntryPredicate predicate) throws IOException { final Enumeration<ZipArchiveEntry> src = getEntriesInPhysicalOrder(); while (src.hasMoreElements()) { final ZipArchiveEntry entry = src.nextElement(); if (predicate.test( entry)) { target.addRawArchiveEntry(entry, getRawInputStream(entry)); } } }
public CloseableIterator( ZipFile zipFile ) { this.en = zipFile.getEntriesInPhysicalOrder(); this.zipFile = zipFile; }
@Override protected Iterator<PlexusIoResource> getEntries() throws IOException { final File f = getFile(); if ( f == null ) { throw new IOException( "The zip file has not been set." ); } final URLClassLoader urlClassLoader = new URLClassLoader( new URL[] { f.toURI().toURL() }, null ) { @Override public URL getResource( String name ) { return findResource( name ); } }; final URL url = new URL( "jar:" + f.toURI().toURL() + "!/" ); final JarFile jarFile = new JarFile( f ); final ZipFile zipFile = new ZipFile( f, charset != null ? charset.name() : "UTF8" ); final Enumeration<ZipArchiveEntry> en = zipFile.getEntriesInPhysicalOrder(); return new ZipFileResourceIterator( en, url, jarFile, zipFile, urlClassLoader ); }
private Enumeration<ZipArchiveEntry> getEntries() { if (entries == null) { entries = file.getEntriesInPhysicalOrder(); } return entries; }
ZipFileIterator(final ZipFile in) { this.in = in; nestedEnum = in.getEntriesInPhysicalOrder(); } @Override
private Enumeration<ZipArchiveEntry> getEntries() { if (entries == null) { entries = file.getEntriesInPhysicalOrder(); } return entries; }
final Enumeration e = zipFile.getEntriesInPhysicalOrder();
final Enumeration e = zf.getEntriesInPhysicalOrder(); while ( e.hasMoreElements() )
@Override protected Iterable<? extends ZipArchiveEntry> getEntries(ZipFileResource container) throws IOException { final Enumeration<? extends ZipArchiveEntry> entries = container.getZipFile().getEntriesInPhysicalOrder(); return new ZipArchiveEntryIterable(entries); }
@Override protected Iterable<? extends ZipArchiveEntry> getEntries(ZipFileResource container) throws IOException { final Enumeration<? extends ZipArchiveEntry> entries = container.getZipFile().getEntriesInPhysicalOrder(); return new ZipArchiveEntryIterable(entries); }
public static void unZip(File file, File target) throws IOException { try (final ZipFile zipFile = new ZipFile(file)) { final Enumeration<ZipArchiveEntry> files = zipFile.getEntriesInPhysicalOrder(); while (files.hasMoreElements()) { final ZipArchiveEntry entry = files.nextElement(); final File entryFile = new File(target, REMOVE_LEADING_GO_PATH_PATTERN.matcher(entry.getName()).replaceFirst("")).getCanonicalFile(); if (entry.isDirectory()) { forceMkdir(entryFile); } else { forceMkdir(entryFile.getParentFile()); try (final InputStream is = zipFile.getInputStream(entry)) { try (final OutputStream os = new FileOutputStream(entryFile)) { copy(is, os); } } } } } } }
public static void unZip(Path file, Path target) throws IOException { try (final ZipFile zipFile = new ZipFile(file.toFile())) { final Enumeration<ZipArchiveEntry> files = zipFile.getEntriesInPhysicalOrder(); while (files.hasMoreElements()) { final ZipArchiveEntry entry = files.nextElement(); final Path entryFile = target.resolve(REMOVE_LEADING_GO_PATH_PATTERN.matcher(entry.getName()).replaceFirst("")).toAbsolutePath(); if (entry.isDirectory()) { createDirectoriesIfRequired(entryFile); } else { ensureParentOf(entryFile); try (final InputStream is = zipFile.getInputStream(entry)) { try (final OutputStream os = newOutputStream(entryFile)) { copy(is, os); } } } } } } }
/** * Transfer selected entries from this zipfile to a given #ZipArchiveOutputStream. * Compression and all other attributes will be as in this file. * <p>This method transfers entries based on the central directory of the zip file.</p> * * @param target The zipArchiveOutputStream to write the entries to * @param predicate A predicate that selects which entries to write * @throws IOException on error */ public void copyRawEntries(final ZipArchiveOutputStream target, final ZipArchiveEntryPredicate predicate) throws IOException { final Enumeration<ZipArchiveEntry> src = getEntriesInPhysicalOrder(); while (src.hasMoreElements()) { final ZipArchiveEntry entry = src.nextElement(); if (predicate.test( entry)) { target.addRawArchiveEntry(entry, getRawInputStream(entry)); } } }
try { zipFile = new ZipFile(archiveFile); Enumeration<ZipArchiveEntry> zipEntries = zipFile.getEntriesInPhysicalOrder(); while (zipEntries.hasMoreElements()) { ZipArchiveEntry entry = zipEntries.nextElement();
final Enumeration<ZipArchiveEntry> entries = this.zipFile.getEntriesInPhysicalOrder(); @Nullable private InputStream stream;
final Enumeration<ZipArchiveEntry> entries = this.zipFile.getEntriesInPhysicalOrder(); @Nullable private InputStream stream;