org.apache.commons.compress.archivers.zip.ZipFile.getEntriesInPhysicalOrder()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(160)

本文整理了Java中org.apache.commons.compress.archivers.zip.ZipFile.getEntriesInPhysicalOrder()方法的一些代码示例,展示了ZipFile.getEntriesInPhysicalOrder()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipFile.getEntriesInPhysicalOrder()方法的具体详情如下:
包路径:org.apache.commons.compress.archivers.zip.ZipFile
类名称:ZipFile
方法名:getEntriesInPhysicalOrder

ZipFile.getEntriesInPhysicalOrder介绍

[英]Returns all entries in physical order.

Entries will be returned in the same order their contents appear within the archive.
[中]按物理顺序返回所有条目。
条目将按其内容在存档中出现的顺序返回。

代码示例

代码示例来源:origin: org.apache.commons/commons-compress

ZipFileIterator(final ZipFile in) {
  this.in = in;
  nestedEnum = in.getEntriesInPhysicalOrder();
}
@Override

代码示例来源:origin: org.apache.commons/commons-compress

/**
 * 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));
    }
  }
}

代码示例来源:origin: org.codehaus.plexus/plexus-archiver

public CloseableIterator( ZipFile zipFile )
{
  this.en = zipFile.getEntriesInPhysicalOrder();
  this.zipFile = zipFile;
}

代码示例来源:origin: org.codehaus.plexus/plexus-archiver

@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 );
}

代码示例来源:origin: org.rauschig/jarchivelib

private Enumeration<ZipArchiveEntry> getEntries() {
  if (entries == null) {
    entries = file.getEntriesInPhysicalOrder();
  }
  return entries;
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

ZipFileIterator(final ZipFile in) {
  this.in = in;
  nestedEnum = in.getEntriesInPhysicalOrder();
}
@Override

代码示例来源:origin: thrau/jarchivelib

private Enumeration<ZipArchiveEntry> getEntries() {
  if (entries == null) {
    entries = file.getEntriesInPhysicalOrder();
  }
  return entries;
}

代码示例来源:origin: org.codehaus.plexus/plexus-archiver

final Enumeration e = zipFile.getEntriesInPhysicalOrder();

代码示例来源:origin: org.codehaus.plexus/plexus-archiver

final Enumeration e = zf.getEntriesInPhysicalOrder();
while ( e.hasMoreElements() )

代码示例来源:origin: com.buschmais.jqassistant.plugin/common

@Override
protected Iterable<? extends ZipArchiveEntry> getEntries(ZipFileResource container) throws IOException {
  final Enumeration<? extends ZipArchiveEntry> entries = container.getZipFile().getEntriesInPhysicalOrder();
  return new ZipArchiveEntryIterable(entries);
}

代码示例来源:origin: com.buschmais.jqassistant.plugin/jqassistant.plugin.common

@Override
protected Iterable<? extends ZipArchiveEntry> getEntries(ZipFileResource container) throws IOException {
  final Enumeration<? extends ZipArchiveEntry> entries = container.getZipFile().getEntriesInPhysicalOrder();
  return new ZipArchiveEntryIterable(entries);
}

代码示例来源:origin: gradle.plugin.org.echocat.gradle.plugins/gradle-golang-plugin

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);
            }
          }
        }

      }
    }
  }
}

代码示例来源:origin: echocat/gradle-golang-plugin

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);
            }
          }
        }
      }
    }
  }
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

/**
 * 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));
    }
  }
}

代码示例来源:origin: org.overlord.sramp/s-ramp-atom

try {
  zipFile = new ZipFile(archiveFile);
  Enumeration<ZipArchiveEntry> zipEntries = zipFile.getEntriesInPhysicalOrder();
  while (zipEntries.hasMoreElements()) {
    ZipArchiveEntry entry = zipEntries.nextElement();

代码示例来源:origin: de.unkrig.commons/commons-file

final Enumeration<ZipArchiveEntry> entries = this.zipFile.getEntriesInPhysicalOrder();
@Nullable private InputStream      stream;

代码示例来源:origin: de.unkrig/de-unkrig-commons

final Enumeration<ZipArchiveEntry> entries = this.zipFile.getEntriesInPhysicalOrder();
@Nullable private InputStream      stream;

相关文章