The SXSSF temp xml file is grows to a very large size. e.g. for a 20 MB csv data the size of the temp xml file become few GB large. In order to reduce this I have created a path and tested it.
Request for the review and application of the same to the. I have not changed the extension of the temp file from xml to gz, which is another cleanliness factor. Regards Santosh >From f4a7abb0b18a225bb8c22248da0fdde7bf884652 Mon Sep 17 00:00:00 2001 From: Santosh <[email protected]> Date: Tue, 4 Oct 2011 12:11:23 +0530 Subject: [PATCH] Compress the temporary xml file --- .../org/apache/poi/xssf/streaming/SXSSFSheet.java | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java index 8c1b998..f3c6dea 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java @@ -22,6 +22,8 @@ import java.util.Iterator; import java.util.TreeMap; import java.util.Map; +import java.util.zip.GZIPOutputStream; +import java.util.zip.GZIPInputStream; import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.util.CellReference; @@ -1286,7 +1288,7 @@ public class SXSSFSheet implements Sheet, Cloneable { _fd = File.createTempFile("poi-sxxsf-sheet", ".xml"); _fd.deleteOnExit(); - _out = new BufferedWriter(new FileWriter(_fd)); + _out = new OutputStreamWriter(new GZIPOutputStream (new FileOutputStream(_fd))); } public int getNumberOfFlushedRows() { @@ -1308,7 +1310,8 @@ public class SXSSFSheet implements Sheet, Cloneable { _out.flush(); _out.close(); - return new FileInputStream(_fd); + + return new GZIPInputStream ( new FileInputStream(_fd)); } /** -- 1.7.6.msysgit.0 =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
