本文整理汇总了Java中net.lingala.zip4j.model.FileHeader.getExtraDataRecords方法的典型用法代码示例。如果您正苦于以下问题:Java FileHeader.getExtraDataRecords方法的具体用法?Java FileHeader.getExtraDataRecords怎么用?Java FileHeader.getExtraDataRecords使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.lingala.zip4j.model.FileHeader
的用法示例。
在下文中一共展示了FileHeader.getExtraDataRecords方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readAndSaveAESExtraDataRecord
import net.lingala.zip4j.model.FileHeader; //导入方法依赖的package包/类
/**
* Reads AES Extra Data Record and saves it in the {@link FileHeader}
* @param fileHeader
* @throws ZipException
*/
private void readAndSaveAESExtraDataRecord(FileHeader fileHeader) throws ZipException {
if (fileHeader == null) {
throw new ZipException("file header is null in reading Zip64 Extended Info");
}
if (fileHeader.getExtraDataRecords() == null || fileHeader.getExtraDataRecords().size() <= 0) {
return;
}
AESExtraDataRecord aesExtraDataRecord = readAESExtraDataRecord(fileHeader.getExtraDataRecords());
if (aesExtraDataRecord != null) {
fileHeader.setAesExtraDataRecord(aesExtraDataRecord);
fileHeader.setEncryptionMethod(Zip4jConstants.ENC_METHOD_AES);
}
}
示例2: readAndSaveZip64ExtendedInfo
import net.lingala.zip4j.model.FileHeader; //导入方法依赖的package包/类
/**
* Reads Zip64 Extended info and saves it in the {@link FileHeader}
* @param fileHeader
* @throws ZipException
*/
private void readAndSaveZip64ExtendedInfo(FileHeader fileHeader) throws ZipException {
if (fileHeader == null) {
throw new ZipException("file header is null in reading Zip64 Extended Info");
}
if (fileHeader.getExtraDataRecords() == null || fileHeader.getExtraDataRecords().size() <= 0) {
return;
}
Zip64ExtendedInfo zip64ExtendedInfo = readZip64ExtendedInfo(
fileHeader.getExtraDataRecords(),
fileHeader.getUncompressedSize(),
fileHeader.getCompressedSize(),
fileHeader.getOffsetLocalHeader(),
fileHeader.getDiskNumberStart());
if (zip64ExtendedInfo != null) {
fileHeader.setZip64ExtendedInfo(zip64ExtendedInfo);
if (zip64ExtendedInfo.getUnCompressedSize() != -1)
fileHeader.setUncompressedSize(zip64ExtendedInfo.getUnCompressedSize());
if (zip64ExtendedInfo.getCompressedSize() != -1)
fileHeader.setCompressedSize(zip64ExtendedInfo.getCompressedSize());
if (zip64ExtendedInfo.getOffsetLocalHeader() != -1)
fileHeader.setOffsetLocalHeader(zip64ExtendedInfo.getOffsetLocalHeader());
if (zip64ExtendedInfo.getDiskNumberStart() != -1)
fileHeader.setDiskNumberStart(zip64ExtendedInfo.getDiskNumberStart());
}
}