I have one question. Am I right that if I have a workbook which is created through xssf
constructor then it is enough to change the constructor to sxssf
workbook (with xssf
wb passed as an argument) to make it work in a stream mode
? Thanks a lof for your answers.
Solution: It all depends on the classes which you use for streaming. If your class gathers more stream buffers than it can hold, this thing won't work. Otherwise it will
Yes, you're right. The difference between these two implementations is that stream version writes data directly to stream and stores at most specified number of rows in memory (default value is 100 and it's stored in SXSSFWorkbook.DEFAULT_WINDOW_SIZE). Because of that you won't be able to get some row data after writing to output stream. Big benefit of using stream implementation is less memory usage. If you need to export a lot of data just use SXSSFWorkbook.
Example:
Output:
As you see row 1 is not accessible any more after writing to output stream with SXSSFWorkbook.