Bug 51362 - Different between SXSSFWorkbook api and Example given.
Summary: Different between SXSSFWorkbook api and Example given.
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: SXSSF (show other bugs)
Version: 3.8-dev
Hardware: PC All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-13 07:56 UTC by anant.jagania
Modified: 2015-03-23 20:55 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.