本文整理了Java中org.apache.commons.compress.archivers.zip.ZipFile.tryToLocateSignature()
方法的一些代码示例,展示了ZipFile.tryToLocateSignature()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipFile.tryToLocateSignature()
方法的具体详情如下:
包路径:org.apache.commons.compress.archivers.zip.ZipFile
类名称:ZipFile
方法名:tryToLocateSignature
[英]Searches the archive backwards from minDistance to maxDistance for the given signature, positions the RandomaccessFile right at the signature if it has been found.
[中]从MindDistance到maxDistance向后搜索给定签名的存档,如果已找到,则将RandomaccessFile定位在签名处。
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Searches for the and positions the stream at the start of the
* "End of central dir record".
*/
private void positionAtEndOfCentralDirectoryRecord()
throws IOException {
final boolean found = tryToLocateSignature(MIN_EOCD_SIZE, MAX_EOCD_SIZE,
ZipArchiveOutputStream.EOCD_SIG);
if (!found) {
throw new ZipException("archive is not a ZIP archive");
}
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
* Searches for the and positions the stream at the start of the
* "End of central dir record".
*/
private void positionAtEndOfCentralDirectoryRecord()
throws IOException {
final boolean found = tryToLocateSignature(MIN_EOCD_SIZE, MAX_EOCD_SIZE,
ZipArchiveOutputStream.EOCD_SIG);
if (!found) {
throw new ZipException("archive is not a ZIP archive");
}
}
内容来源于网络,如有侵权,请联系作者删除!