增加如下两行代码: ZipInputStreamZipEntrySource.setThresholdBytesForTempFiles(50000000); ZipPackage.setUseTempFilePackageParts(true);
亲测有效
参考api接口文档:
https://poi.apache.org/apidocs/dev/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.html
默认是不开启使用临时文件,开启后推荐配置为50M:
Get the threshold at which it a zip entry is regarded as too large for holding in memory and the data is put in a temp file instead (defaults to -1 meaning temp files are not used)
A threshold like 50000000 (approx 50Mb is recommended)