From dde2d28102037a0ef5b488ea8d0cd808d6543940 Mon Sep 17 00:00:00 2001
From: Yegor Kozlov
Date: Fri, 16 Dec 2011 10:11:45 +0000
Subject: [PATCH] Addition to Bugzilla 51961: enable compression of temp files
when loading existing workbook
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1215080 13f79535-47bb-0310-9956-ffa450edef68
---
.../poi/xssf/streaming/SXSSFWorkbook.java | 27 ++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
index 710bff8b91..a9cdd954ec 100644
--- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
+++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
@@ -104,7 +104,33 @@ public class SXSSFWorkbook implements Workbook
* @param rowAccessWindowSize
*/
public SXSSFWorkbook(XSSFWorkbook workbook, int rowAccessWindowSize){
+ this(workbook,rowAccessWindowSize, false);
+ }
+
+ /**
+ * Constructs an workbook from an existing workbook.
+ *
+ * When a new node is created via createRow() and the total number
+ * of unflushed records would exceed the specified value, then the
+ * row with the lowest index value is flushed and cannot be accessed
+ * via getRow() anymore.
+ *
+ *
+ * A value of -1 indicates unlimited access. In this case all
+ * records that have not been flushed by a call to flush() are available
+ * for random access.
+ *
+ *
+ * A value of 0 is not allowed because it would flush any newly created row
+ * without having a chance to specify any cells.
+ *
+ *
+ * @param rowAccessWindowSize
+ * @param compressTmpFiles whether to use gzip compression for temporary files
+ */
+ public SXSSFWorkbook(XSSFWorkbook workbook, int rowAccessWindowSize, boolean compressTmpFiles){
setRandomAccessWindowSize(rowAccessWindowSize);
+ setCompressTempFiles(compressTmpFiles);
if (workbook == null)
{
_wb=new XSSFWorkbook();
@@ -119,7 +145,6 @@ public class SXSSFWorkbook implements Workbook
}
}
}
-
/**
* Construct an empty workbook and specify the window for row access.
*
--
2.39.5