Bug 65581

Summary: add optional support in ZipArchiveFakeEntry to use a temp file
Product: POI Reporter: PJ Fanning <fanningpj>
Component: POI OverallAssignee: POI Developers List <dev>
Severity: normal    
Priority: P2    
Version: 5.0.x-dev   
Target Milestone: ---   
Hardware: All   
OS: All   

Description PJ Fanning 2021-09-18 13:54:17 UTC
Currently, ZipArchiveFakeEntry will read all the bytes of the file into memory unless there are more than 2GB (Integer.MAX_VALUE) - in which case it throws an error.

The workaround is to load the data from a java.io.File instead of an InputStream but this may not be obvious or straightforward.

Aim is to have a configurable value at which ZipArchiveFakeEntry creates a temp file (or an equivalent class).
Comment 1 PJ Fanning 2021-09-18 13:55:24 UTC
IOException("ZIP entry size is too large or invalid") is the existing exception
Comment 2 PJ Fanning 2021-09-18 20:09:27 UTC
added implementation using r1893421

Using this will mean all zip entries with greater than 50Mb decompressed data will be put in a temp file instead of kept in memory.

This only affects users when they read files using Input Streams instead of reading directly from a java.io.File.
Comment 3 PJ Fanning 2021-09-19 20:08:30 UTC
ZipInputStreamZipEntrySource.setEncryptTempFiles(true); //also now supported