gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-16 20:02:40 25 4
gpt4 key购买 nike

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

ZipFile.positionAtEndOfCentralDirectoryRecord介绍

[英]Searches for the and positions the stream at the start of the "End of central dir record".
[中]搜索并将流定位在“中心目录记录的结尾”的开头。

代码示例

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

/**
 * Searches for either the "Zip64 end of central directory
 * locator" or the "End of central dir record", parses
 * it and positions the stream at the first central directory
 * record.
 */
private void positionAtCentralDirectory()
  throws IOException {
  positionAtEndOfCentralDirectoryRecord();
  boolean found = false;
  final boolean searchedForZip64EOCD =
    archive.position() > ZIP64_EOCDL_LENGTH;
  if (searchedForZip64EOCD) {
    archive.position(archive.position() - ZIP64_EOCDL_LENGTH);
    wordBbuf.rewind();
    IOUtils.readFully(archive, wordBbuf);
    found = Arrays.equals(ZipArchiveOutputStream.ZIP64_EOCD_LOC_SIG,
               wordBuf);
  }
  if (!found) {
    // not a ZIP64 archive
    if (searchedForZip64EOCD) {
      skipBytes(ZIP64_EOCDL_LENGTH - WORD);
    }
    positionAtCentralDirectory32();
  } else {
    positionAtCentralDirectory64();
  }
}

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

/**
 * Searches for either the "Zip64 end of central directory
 * locator" or the "End of central dir record", parses
 * it and positions the stream at the first central directory
 * record.
 */
private void positionAtCentralDirectory()
  throws IOException {
  positionAtEndOfCentralDirectoryRecord();
  boolean found = false;
  final boolean searchedForZip64EOCD =
    archive.position() > ZIP64_EOCDL_LENGTH;
  if (searchedForZip64EOCD) {
    archive.position(archive.position() - ZIP64_EOCDL_LENGTH);
    wordBbuf.rewind();
    IOUtils.readFully(archive, wordBbuf);
    found = Arrays.equals(ZipArchiveOutputStream.ZIP64_EOCD_LOC_SIG,
               wordBuf);
  }
  if (!found) {
    // not a ZIP64 archive
    if (searchedForZip64EOCD) {
      skipBytes(ZIP64_EOCDL_LENGTH - WORD);
    }
    positionAtCentralDirectory32();
  } else {
    positionAtCentralDirectory64();
  }
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com