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

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

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

ZipFile.populateFromCentralDirectory介绍

[英]Reads the central directory of the given archive and populates the internal tables with ZipArchiveEntry instances.

The ZipArchiveEntrys will know all data that can be obtained from the central directory alone, but not the data that requires the local file header or additional data to be read.
[中]读取给定存档的中心目录,并用ZipArchiveEntry实例填充内部表。
ZiparchiveEntry将知道可以单独从中央目录获得的所有数据,但不知道需要读取本地文件头或其他数据的数据。

代码示例

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

private ZipFile(final SeekableByteChannel channel, final String archiveName,
        final String encoding, final boolean useUnicodeExtraFields,
        final boolean closeOnError)
  throws IOException {
  this.archiveName = archiveName;
  this.encoding = encoding;
  this.zipEncoding = ZipEncodingHelper.getZipEncoding(encoding);
  this.useUnicodeExtraFields = useUnicodeExtraFields;
  archive = channel;
  boolean success = false;
  try {
    final Map<ZipArchiveEntry, NameAndComment> entriesWithoutUTF8Flag =
      populateFromCentralDirectory();
    resolveLocalFileHeaderData(entriesWithoutUTF8Flag);
    success = true;
  } finally {
    closed = !success;
    if (!success && closeOnError) {
      IOUtils.closeQuietly(archive);
    }
  }
}

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

private ZipFile(final SeekableByteChannel channel, final String archiveName,
        final String encoding, final boolean useUnicodeExtraFields,
        final boolean closeOnError)
  throws IOException {
  this.archiveName = archiveName;
  this.encoding = encoding;
  this.zipEncoding = ZipEncodingHelper.getZipEncoding(encoding);
  this.useUnicodeExtraFields = useUnicodeExtraFields;
  archive = channel;
  boolean success = false;
  try {
    final Map<ZipArchiveEntry, NameAndComment> entriesWithoutUTF8Flag =
      populateFromCentralDirectory();
    resolveLocalFileHeaderData(entriesWithoutUTF8Flag);
    success = true;
  } finally {
    closed = !success;
    if (!success && closeOnError) {
      IOUtils.closeQuietly(archive);
    }
  }
}

相关文章