Bug 51362

Summary: Different between SXSSFWorkbook api and Example given.
Product: POI Reporter: anant.jagania
Component: SXSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major CC: anant.jagania
Priority: P2    
Version: 3.8-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description anant.jagania 2011-06-13 07:56:51 UTC
I was looking at the example of SXSSFWorkbook given at
http://poi.apache.org/spreadsheet/how-to.html#sxssf

And found relevant to what I need. Unfortunately it doesn't match up with the API given below.
http://poi.apache.org/apidocs/org/apache/poi/xssf/streaming/SXSSFWorkbook.html

In the example there is a constructor with Integer argument but in API its not.

First of all in the jar file of 3.7 there is no such package called  org.apache.poi.xssf.streaming. Looking at 3.8 jar file we have the package but example given and the API are not same at all. E.g. flushRow method is not available in SXSSFSheet but its given in the example.

Are these features would be available in final version of 3.8?

Also, using 3.8 b3 I got the following exceptions. This happens when I have multiple sheets in the workbook and I am writing file to disk.


java.io.IOException: Stream closed
        at sun.nio.cs.StreamEncoder.ensureOpen(StreamEncoder.java:44)
        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:117)
        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:134)
        at java.io.OutputStreamWriter.write(OutputStreamWriter.java:220)
        at java.io.Writer.write(Writer.java:157)
        at org.apache.poi.xssf.streaming.SXSSFSheet$SheetDataWriter.getWorksheetXMLInputStream(SXSSFSheet.java:1267)
        at org.apache.poi.xssf.streaming.SXSSFSheet.getWorksheetXMLInputStream(SXSSFSheet.java:62)
        at org.apache.poi.xssf.streaming.SXSSFWorkbook.injectData(SXSSFWorkbook.java:108)
        at org.apache.poi.xssf.streaming.SXSSFWorkbook.write(SXSSFWorkbook.java:496)
Comment 1 Nick Burch 2011-06-13 09:17:34 UTC
I'd suggest you try a nightly build or your own checkout from svn - SXSSF is very new
Comment 2 Yegor Kozlov 2011-06-13 10:47:22 UTC
The constructor SXSSFWorkbook(int windowSize) and flushRows() are in trunk only, they are  not included in 3.8-beta3. 

Please post a sample code that results in the "java.io.IOException: Stream closed" exception. The SXSSF API is new and some operations may not be well tested.

Nightly builds can be downloaded from here: http://encore.torchbox.com/poi-cvs-build/

Yegor
Comment 3 anant.jagania 2011-06-13 12:10:38 UTC
Yegor,

Thanks for the info.

The "java.io.IOException: Stream closed" exception was coming due to writing on the same file with different data without giving the inputstream of the original file to workbook object. So I have solved it by writing into a new file every time. 

I will try the code with flushRows and int argument constructor by checking out the code from SVN.

However, I suggest a document change as it is misleading to API and sample example.
Comment 4 Dominik Stadler 2015-03-23 20:55:24 UTC
As far as I see API Doc, Code and Examples on the homepage match nowadays.