Java解压包含很多小文件的压缩文件
作者:G0561 / 发布于2015/6/25/ 571

如果压缩文件中包含很多文件,使用 Zip4j 解压文件时会导致内存溢出。
ZipFile zipFile = new ZipFile("压缩文件.zip");
zipFile.extractAll("目标文件夹");

下面代码依赖commons-compress来解压文件
<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-compress</artifactId>
    <version>1.9</version>
</dependency>

评论列表