]> source.dussan.org Git - poi.git/commitdiff
Addition to Bugzilla 51961: enable compression of temp files when loading existing...
authorYegor Kozlov <yegor@apache.org>
Fri, 16 Dec 2011 10:11:45 +0000 (10:11 +0000)
committerYegor Kozlov <yegor@apache.org>
Fri, 16 Dec 2011 10:11:45 +0000 (10:11 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1215080 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java

index 710bff8b9140fddead6a07c877101b6f93d655f6..a9cdd954ec3845dffcfd59d2fb1ba2e4593ffa4d 100644 (file)
@@ -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.
+     * <p>
+     * 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.
+     * </p>
+     * <p>
+     * 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.
+     * <p>
+     * <p></p>
+     * A value of 0 is not allowed because it would flush any newly created row
+     * without having a chance to specify any cells.
+     * </p>
+     *
+     * @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.
      * <p>