poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdirkse <maarten.dir...@gmail.com>
Subject Strange behaviour in OPCPackage.open
Date Wed, 20 Oct 2010 14:47:55 GMT

I'm noticing some strange behaviour in the OPCPackage.open method when
trying to open very large XLSX file. The file in question is 25mb, but if
you unzip the contents it's > 250mb.

The following line works: 
XSSFReader r = new XSSFReader(OPCPackage.open("/some/large/file.xlsx"));

However, this line doesn't work:
XSSFReader r = new XSSFReader(OPCPackage.open(new FileInputStream(new

It breaks with an OOME:

java.lang.OutOfMemoryError: Java heap space
	at java.util.Arrays.copyOf(Arrays.java:2786)
	at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
	at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:82)
	at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:220)

Apparently the openxml4j code can handle the file, just not when it's
presented as an inputstream. My problem is that, in my code, I can't get at
the file, and have to use the inputstream. So how do I prevent it from
throwing an OOME whilst still using the inputstream?

I'm using POI 3.6 on JDK 1.6.

Thanks in advance,
View this message in context: http://apache-poi.1045710.n5.nabble.com/Strange-behaviour-in-OPCPackage-open-tp3228772p3228772.html
Sent from the POI - User mailing list archive at Nabble.com.

To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org

View raw message