本文介绍了Java压缩库支持Deflate64的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

寻找Apache Commons Compress的替代压缩Java库( https://commons.apache .org/proper/commons-compress/).尝试读取使用deflate64的"ENHANCED_DEFLATED"压缩的zip条目时,Commons Compress引发错误.这是引发异常的示例摘录.

Looking for an alternative compression java library to Apache Commons Compress (https://commons.apache.org/proper/commons-compress/). Commons Compress throws an error when trying to read a zip entry that was compressed using "ENHANCED_DEFLATED" which is deflate64. Here is sample excerpt that throws the exception.

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();
}

这是堆栈跟踪的相关部分:

Here is the relevant part of the stack trace:

有人知道另一个可以替代Commons Compress的zip库,或者可以与它一起使用deflate64压缩方法吗?

Does anyone know of another zip library that could replace Commons Compress, or possibly work in conjunction with it for the deflate64 compression method?

推荐答案

2018年2月,Apache发布了压缩v1.16 ,其中包括对ENHANCED_DEFLATED的支持,即. Deflate64.我需要这种支持,发现它似乎可以工作.

In February 2018, Apache released Compress v1.16 which includes support for ENHANCED_DEFLATED, ie. Deflate64. I needed this support and found that it seems to work.

这篇关于Java压缩库支持Deflate64的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 23:24