- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.commons.compress.archivers.zip.ZipFile.skipBytes()
方法的一些代码示例,展示了ZipFile.skipBytes()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipFile.skipBytes()
方法的具体详情如下:
包路径:org.apache.commons.compress.archivers.zip.ZipFile
类名称:ZipFile
方法名:skipBytes
[英]Skips the given number of bytes or throws an EOFException if skipping failed.
[中]跳过给定的字节数,如果跳过失败,则抛出EOFEException。
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Parses the "End of central dir record" and positions
* the stream at the first central directory record.
*
* Expects stream to be positioned at the beginning of the
* "End of central dir record".
*/
private void positionAtCentralDirectory32()
throws IOException {
skipBytes(CFD_LOCATOR_OFFSET);
wordBbuf.rewind();
IOUtils.readFully(archive, wordBbuf);
archive.position(ZipLong.getValue(wordBuf));
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Parses the "Zip64 end of central directory locator",
* finds the "Zip64 end of central directory record" using the
* parsed information, parses that and positions the stream at the
* first central directory record.
*
* Expects stream to be positioned right behind the "Zip64
* end of central directory locator"'s signature.
*/
private void positionAtCentralDirectory64()
throws IOException {
skipBytes(ZIP64_EOCDL_LOCATOR_OFFSET
- WORD /* signature has already been read */);
dwordBbuf.rewind();
IOUtils.readFully(archive, dwordBbuf);
archive.position(ZipEightByteInteger.getLongValue(dwordBuf));
wordBbuf.rewind();
IOUtils.readFully(archive, wordBbuf);
if (!Arrays.equals(wordBuf, ZipArchiveOutputStream.ZIP64_EOCD_SIG)) {
throw new ZipException("archive's ZIP64 end of central "
+ "directory locator is corrupt.");
}
skipBytes(ZIP64_EOCD_CFD_LOCATOR_OFFSET
- WORD /* signature has already been read */);
dwordBbuf.rewind();
IOUtils.readFully(archive, dwordBbuf);
archive.position(ZipEightByteInteger.getLongValue(dwordBuf));
}
代码示例来源:origin: org.apache.commons/commons-compress
wordBbuf.get(shortBuf);
final int extraFieldLen = ZipShort.getValue(shortBuf);
skipBytes(fileNameLen);
final byte[] localExtraData = new byte[extraFieldLen];
IOUtils.readFully(archive, ByteBuffer.wrap(localExtraData));
代码示例来源: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
/**
* Parses the "End of central dir record" and positions
* the stream at the first central directory record.
*
* Expects stream to be positioned at the beginning of the
* "End of central dir record".
*/
private void positionAtCentralDirectory32()
throws IOException {
skipBytes(CFD_LOCATOR_OFFSET);
wordBbuf.rewind();
IOUtils.readFully(archive, wordBbuf);
archive.position(ZipLong.getValue(wordBuf));
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
* Parses the "Zip64 end of central directory locator",
* finds the "Zip64 end of central directory record" using the
* parsed information, parses that and positions the stream at the
* first central directory record.
*
* Expects stream to be positioned right behind the "Zip64
* end of central directory locator"'s signature.
*/
private void positionAtCentralDirectory64()
throws IOException {
skipBytes(ZIP64_EOCDL_LOCATOR_OFFSET
- WORD /* signature has already been read */);
dwordBbuf.rewind();
IOUtils.readFully(archive, dwordBbuf);
archive.position(ZipEightByteInteger.getLongValue(dwordBuf));
wordBbuf.rewind();
IOUtils.readFully(archive, wordBbuf);
if (!Arrays.equals(wordBuf, ZipArchiveOutputStream.ZIP64_EOCD_SIG)) {
throw new ZipException("archive's ZIP64 end of central "
+ "directory locator is corrupt.");
}
skipBytes(ZIP64_EOCD_CFD_LOCATOR_OFFSET
- WORD /* signature has already been read */);
dwordBbuf.rewind();
IOUtils.readFully(archive, dwordBbuf);
archive.position(ZipEightByteInteger.getLongValue(dwordBuf));
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
wordBbuf.get(shortBuf);
final int extraFieldLen = ZipShort.getValue(shortBuf);
skipBytes(fileNameLen);
final byte[] localExtraData = new byte[extraFieldLen];
IOUtils.readFully(archive, ByteBuffer.wrap(localExtraData));
代码示例来源: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();
}
}
Sun Documentation for DataInput.skipBytes指出它“试图从输入流中跳过 n 个字节的数据,并丢弃跳过的字节。但是,它可能会跳过一些较小数量的字节,可能为零。这可能
本文整理了Java中org.apache.commons.compress.archivers.zip.ZipFile.skipBytes()方法的一些代码示例,展示了ZipFile.skipByte
我是一名优秀的程序员,十分优秀!