寻找一款替代 Apache Commons Compress(https://commons.apache.org/proper/commons-compress/)的 Java 压缩库。当尝试读取使用“ENHANCED_DEFLATED”(即 deflate64)压缩的 zip 条目时,Commons Compress 会抛出错误。以下是一个抛出异常的示例摘录。
以下是堆栈跟踪的相关部分:
org.apache.commons.compress.archivers.zip.UnsupportedZipFeatureException: 不支持在条目 test.docx 中使用增强压缩方法“ENHANCED_DEFLATED”。 at org.apache.commons.compress.archivers.zip.ZipUtil.checkRequestedFeatures(ZipUtil.java:357) at org.apache.commons.compress.archivers.zip.ZipFile.getInputStream(ZipFile.java:404) at ZippingAround.doRecurseZip(ZippingAround.java:23)
有没有人知道其他可以替换Commons Compress或与其一起使用Deflate64压缩方法的zip库?
public void doRecurseZip(File inputFile)
throws IOException{
ZipFile srcZip = null;
srcZip = new ZipFile(inputFile);
final Enumeration<ZipArchiveEntry> entries = srcZip.getEntries();
while (entries.hasMoreElements()) {
final ZipArchiveEntry srcEntry = entries.nextElement();
String entryFilename = srcEntry.getName();
String entryMimetype = "application/octet-stream";
boolean canRead = srcZip.canReadEntryData(srcEntry);
InputStream zipStream = srcZip.getInputStream(srcEntry);
zipStream.close();
}
srcZip.close();
}
以下是堆栈跟踪的相关部分:
org.apache.commons.compress.archivers.zip.UnsupportedZipFeatureException: 不支持在条目 test.docx 中使用增强压缩方法“ENHANCED_DEFLATED”。 at org.apache.commons.compress.archivers.zip.ZipUtil.checkRequestedFeatures(ZipUtil.java:357) at org.apache.commons.compress.archivers.zip.ZipFile.getInputStream(ZipFile.java:404) at ZippingAround.doRecurseZip(ZippingAround.java:23)
有没有人知道其他可以替换Commons Compress或与其一起使用Deflate64压缩方法的zip库?