]> source.dussan.org Git - poi.git/commitdiff
Bugzilla 51961: support compression of temp files in SXSSF
authorYegor Kozlov <yegor@apache.org>
Fri, 9 Dec 2011 11:04:22 +0000 (11:04 +0000)
committerYegor Kozlov <yegor@apache.org>
Fri, 9 Dec 2011 11:04:22 +0000 (11:04 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1212330 13f79535-47bb-0310-9956-ffa450edef68

16 files changed:
src/documentation/content/xdocs/spreadsheet/how-to.xml
src/documentation/content/xdocs/status.xml
src/ooxml/java/org/apache/poi/xssf/streaming/GZIPSheetDataWriter.java [new file with mode: 0644]
src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java
src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java [new file with mode: 0644]
src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFCell.java [new file with mode: 0644]
src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFHyperlink.java [new file with mode: 0644]
src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFRow.java [new file with mode: 0644]
src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java [new file with mode: 0644]
src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java [new file with mode: 0644]
src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFCell.java [deleted file]
src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFHyperlink.java [deleted file]
src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFRow.java [deleted file]
src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFSheet.java [deleted file]
src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFWorkbook.java [deleted file]

index 3f423d9fc368d6f612e61e2e3341ea32d8f909d0..f51cf7372b50a2f73a739caf4bd8e67a8b885332 100644 (file)
@@ -739,6 +739,16 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
 
 
 ]]></source>
+<p>SXSSF flushes sheet data in temporary files (a temp file per sheet) and the size of these temporary files 
+can grow to a very large value. For example, for a 20 MB csv data the size of the temp xml becomes more than a gigabyte.
+If the size of the temp files is an issue, you can tell SXSSF to use gzip compression:
+</p>
+<source><![CDATA[
+  SXSSFWorkbook wb = new SXSSFWorkbook(); 
+  wb.setCompressTempFiles(true); // temp files will be gzipped
+
+]]></source>
+
      </section>
 
      <anchor id="low_level_api" />
index f90dec6012f9df734c17d32ef64925e507bb453b..e05178fe90c5eede8441d74e0b52d851b7f9c790 100644 (file)
@@ -34,6 +34,7 @@
 
     <changes>
         <release version="3.8-beta5" date="2011-??-??">
+           <action dev="poi-developers" type="add">51961 - support compression of temp files in SXSSF </action>
            <action dev="poi-developers" type="add">52268 - support cloning sheets with drawings in XSSF </action>
            <action dev="poi-developers" type="add">52285 - Support XWPF smart tags text in Paragraphs</action>
            <action dev="poi-developers" type="fix">51875 - More XSSF new-line in formula support</action>
diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/GZIPSheetDataWriter.java b/src/ooxml/java/org/apache/poi/xssf/streaming/GZIPSheetDataWriter.java
new file mode 100644 (file)
index 0000000..509c9df
--- /dev/null
@@ -0,0 +1,60 @@
+/*\r
+ *  ====================================================================\r
+ *    Licensed to the Apache Software Foundation (ASF) under one or more\r
+ *    contributor license agreements.  See the NOTICE file distributed with\r
+ *    this work for additional information regarding copyright ownership.\r
+ *    The ASF licenses this file to You under the Apache License, Version 2.0\r
+ *    (the "License"); you may not use this file except in compliance with\r
+ *    the License.  You may obtain a copy of the License at\r
+ *\r
+ *        http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *    Unless required by applicable law or agreed to in writing, software\r
+ *    distributed under the License is distributed on an "AS IS" BASIS,\r
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *    See the License for the specific language governing permissions and\r
+ *    limitations under the License.\r
+ * ====================================================================\r
+ */\r
+\r
+package org.apache.poi.xssf.streaming;\r
+\r
+import java.io.*;\r
+import java.util.zip.GZIPInputStream;\r
+import java.util.zip.GZIPOutputStream;\r
+\r
+/**\r
+ * Sheet writer that supports gzip compression of the temp files.\r
+ */\r
+public class GZIPSheetDataWriter extends SheetDataWriter {\r
+\r
+    public GZIPSheetDataWriter() throws IOException {\r
+        super();\r
+    }\r
+\r
+    /**\r
+     * @return temp file to write sheet data\r
+     */\r
+    public File createTempFile()throws IOException {\r
+        File fd = File.createTempFile("poi-sxssf-sheet-xml", ".gz");\r
+        fd.deleteOnExit();\r
+        return fd;\r
+    }\r
+\r
+    /**\r
+     * @return a wrapped instance of GZIPOutputStream\r
+     */\r
+    public Writer createWriter(File fd)throws IOException {\r
+        return new OutputStreamWriter(new GZIPOutputStream(new FileOutputStream(fd)));\r
+    }\r
+\r
+\r
+    /**\r
+     * @return a GZIPInputStream stream to read the compressed temp file\r
+     */\r
+    public InputStream getWorksheetXMLInputStream() throws IOException {\r
+        File fd = getTempFile();\r
+        return new GZIPInputStream(new FileInputStream(fd));\r
+    }\r
+\r
+}\r
index a0f30b82949334caab6c1544810d80c308e591f8..c453203ac98c5298f93597e7e8b235bcfcf2d176 100644 (file)
@@ -23,9 +23,9 @@ import java.util.TreeMap;
 import java.util.Map;
 
 import org.apache.poi.ss.usermodel.*;
-import org.apache.poi.ss.util.CellReference;
 
 import org.apache.poi.ss.util.SheetUtil;
+import org.apache.poi.util.Internal;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 
 import org.apache.poi.hssf.util.PaneInformation;
@@ -48,14 +48,24 @@ public class SXSSFSheet implements Sheet, Cloneable
     {
         _workbook=workbook;
         _sh=xSheet;
-        _writer=new SheetDataWriter();
+        _writer = workbook.createSheetDataWriter();
         setRandomAccessWindowSize(_workbook.getRandomAccessWindowSize());
 
     }
+
+    /**
+     * for testing purposes only
+     */
+    SheetDataWriter getSheetDataWriter(){
+        return _writer;
+    }
+
 /* Gets "<sheetData>" document fragment*/
     public InputStream getWorksheetXMLInputStream() throws IOException 
     {
+        // flush all remaining data and close the temp file writer
         flushRows(0);
+        _writer.close();
         return _writer.getWorksheetXMLInputStream();
     }
 
@@ -1271,260 +1281,4 @@ public class SXSSFSheet implements Sheet, Cloneable
         assert false;
         return -1;
     }
-/*Initially copied from BigGridDemo "SpreadsheetWriter". Unlike the original code which wrote the entire document, this class only writes the "sheetData" document fragment so that it was renamed to "SheetDataWriter"*/
-    public class SheetDataWriter 
-    {
-        private final File _fd;
-        private final Writer _out;
-        private int _rownum;
-        private boolean _rowContainedNullCells=false;
-        int _numberOfFlushedRows;
-        int _lowestIndexOfFlushedRows; // meaningful only of _numberOfFlushedRows>0
-        int _numberOfCellsOfLastFlushedRow; // meaningful only of _numberOfFlushedRows>0
-
-        public SheetDataWriter() throws IOException 
-        {
-            _fd = File.createTempFile("poi-sxssf-sheet", ".xml");
-            _fd.deleteOnExit();
-            _out = new BufferedWriter(new FileWriter(_fd));
-        }
-        public int getNumberOfFlushedRows()
-        {
-            return _numberOfFlushedRows;
-        }
-        public int getNumberOfCellsOfLastFlushedRow()
-        {
-           return _numberOfCellsOfLastFlushedRow;
-        }
-        public int getLowestIndexOfFlushedRows()
-        {
-           return _lowestIndexOfFlushedRows;
-        }
-        protected void finalize() throws Throwable
-        {
-            _fd.delete();
-        }
-        public InputStream getWorksheetXMLInputStream() throws IOException
-        {
-            _out.flush();
-            _out.close();
-            return new FileInputStream(_fd);
-        }
-
-        /**
-         * Write a row to the file
-         *
-         * @param rownum 0-based row number
-         * @param row a row
-         */
-        public void writeRow(int rownum,SXSSFRow row) throws IOException
-        {
-            if(_numberOfFlushedRows==0)
-                _lowestIndexOfFlushedRows=rownum;
-            _numberOfCellsOfLastFlushedRow=row.getLastCellNum();
-            _numberOfFlushedRows++;
-            beginRow(rownum,row);
-            Iterator<Cell> cells=row.allCellsIterator();
-            int columnIndex=0;
-            while(cells.hasNext())
-            {
-                writeCell(columnIndex++,cells.next());
-            }
-            endRow();
-        }
-        void beginRow(int rownum,SXSSFRow row) throws IOException 
-        {
-            _out.write("<row r=\""+(rownum+1)+"\"");
-            if(row.hasCustomHeight())
-                _out.write(" customHeight=\"true\"  ht=\""+row.getHeightInPoints()+"\"");
-            if(row.getZeroHeight())
-                _out.write(" hidden=\"true\"");
-            if(row.isFormatted()) {
-                _out.write(" s=\"" + row._style + "\"");
-                _out.write(" customFormat=\"1\"");
-            }
-            _out.write(">\n");
-            this._rownum = rownum;
-            _rowContainedNullCells=false;
-        }
-
-        void endRow() throws IOException 
-        {
-            _out.write("</row>\n");
-        }
-
-        public void writeCell(int columnIndex,Cell cell) throws IOException 
-        {
-            if(cell==null)
-            {
-                _rowContainedNullCells=true;
-                return;
-            }
-            String ref = new CellReference(_rownum, columnIndex).formatAsString();
-            _out.write("<c r=\""+ref+"\"");
-            CellStyle cellStyle=cell.getCellStyle();
-            if(cellStyle.getIndex() != 0) _out.write(" s=\""+cellStyle.getIndex()+"\"");
-            int cellType=cell.getCellType();
-            switch(cellType)
-            {
-                case Cell.CELL_TYPE_BLANK:
-                {
-                    _out.write(">");
-                    break;
-                }
-                case Cell.CELL_TYPE_FORMULA:
-                {
-                    _out.write(">");
-                    _out.write("<f>");
-                    outputQuotedString(cell.getCellFormula());
-                    _out.write("</f>");
-                    switch (cell.getCachedFormulaResultType()){
-                        case Cell.CELL_TYPE_NUMERIC:
-                            double nval = cell.getNumericCellValue();
-                            if(!Double.isNaN(nval)){
-                                _out.write("<v>"+nval+"</v>");
-                            }
-                            break;
-                    }
-                    break;
-                }
-                case Cell.CELL_TYPE_STRING:
-                {
-                    _out.write(" t=\"inlineStr\">");
-                    _out.write("<is><t>");
-                    outputQuotedString(cell.getStringCellValue());
-                    _out.write("</t></is>");
-                    break;
-                }
-                case Cell.CELL_TYPE_NUMERIC:
-                {
-                    _out.write(" t=\"n\">");
-                    _out.write("<v>"+cell.getNumericCellValue()+"</v>");
-                    break;
-                }
-                case Cell.CELL_TYPE_BOOLEAN:
-                {
-                    _out.write(" t=\"b\">");
-                    _out.write("<v>"+(cell.getBooleanCellValue()?"1":"0")+"</v>");
-                    break;
-                }
-                case Cell.CELL_TYPE_ERROR:
-                {
-                    FormulaError error = FormulaError.forInt(cell.getErrorCellValue());
-
-                    _out.write(" t=\"e\">");
-                    _out.write("<v>" +  error.getString() +"</v>");
-                    break;
-                }
-                default:
-                {
-                    assert false;
-                    throw new RuntimeException("Huh?");
-                }
-            }
-            _out.write("</c>");
-        }
-//Taken from jdk1.3/src/javax/swing/text/html/HTMLWriter.java
-        protected void outputQuotedString(String s) throws IOException
-        {
-            if(s == null || s.length() == 0) {
-               return;
-            }
-            
-            char[] chars=s.toCharArray();
-            int last = 0;
-            int length=s.length();
-            for(int counter = 0; counter < length; counter++) 
-            {
-                char c = chars[counter];
-                switch(c) 
-                {
-                    case '<':
-                    if(counter>last) 
-                    {
-                        _out.write(chars,last,counter-last);
-                    }
-                    last=counter+1;
-                    _out.write("&lt;");
-                    break;
-                case '>':
-                    if(counter > last) 
-                    {
-                        _out.write(chars,last,counter-last);
-                    }
-                    last=counter+1;
-                    _out.write("&gt;");
-                    break;
-                case '&':
-                    if(counter>last) 
-                    {
-                        _out.write(chars,last,counter-last);
-                    }
-                    last=counter+1;
-                    _out.write("&amp;");
-                    break;
-                case '"':
-                    if (counter>last) 
-                    {
-                        _out.write(chars,last,counter-last);
-                    }
-                    last=counter+1;
-                    _out.write("&quot;");
-                    break;
-                    // Special characters
-                case '\n':
-                    if(counter>last) 
-                    {
-                        _out.write(chars,last,counter-last);
-                    }
-                    _out.write("&#xa;");
-                    last=counter+1;
-                    break;
-                case '\t':
-                    if(counter>last) 
-                    {
-                        _out.write(chars,last,counter-last);
-                    }
-                    _out.write("&#x9;");
-                    last=counter+1;
-                    break;
-                case '\r':
-                    if(counter>last) 
-                    {
-                        _out.write(chars,last,counter-last);
-                    }
-                    _out.write("&#xd;");
-                    last=counter+1;
-                    break;
-                case 0xa0:
-                    if(counter>last) 
-                    {
-                        _out.write(chars,last,counter-last);
-                    }
-                    _out.write("&#xa0;");
-                    last=counter+1;
-                    break;
-                default:
-                    if(c<' '||c>127) 
-                    {
-                        if(counter>last) 
-                        {
-                            _out.write(chars,last,counter-last);
-                        }
-                        last=counter+1;
-                        // If the character is outside of ascii, write the
-                        // numeric value.
-                        _out.write("&#");
-                        _out.write(String.valueOf((int)c));
-                        _out.write(";");
-                    }
-                    break;
-                }
-            }
-            if (last<length) 
-            {
-                _out.write(chars,last,length-last);
-            }
-        }
-    }
 }
index 37394593a1cf42ce4afcc21feee71b263d4eab71..710bff8b9140fddead6a07c877101b6f93d655f6 100644 (file)
@@ -66,6 +66,11 @@ public class SXSSFWorkbook implements Workbook
 
     private int _randomAccessWindowSize = DEFAULT_WINDOW_SIZE;
 
+    /**
+     * whetehr temp files should be compressed.
+     */
+    private boolean _compressTmpFiles = false;
+
     /**
      * Construct a new workbook
      */
@@ -151,6 +156,31 @@ public class SXSSFWorkbook implements Workbook
         _randomAccessWindowSize = rowAccessWindowSize;
     }
 
+    /**
+     * Set whether temp files should be compressed.
+     * <p>
+     *   SXSSF writes sheet data in temporary files (a temp file per-sheet)
+     *   and the size of these temp files can grow to to a very large size,
+     *   e.g. for a 20 MB csv data the size of the temp xml file become few GB large.
+     *   If the "compress" flag is set to <code>true</code> then the temporary XML is gzipped.
+     * </p>
+     * <p>
+     *     Please note the the "compress" option may cause performance penalty.
+     * </p>
+     * @param compress whether to compress temp files
+     */
+    public void setCompressTempFiles(boolean compress){
+        _compressTmpFiles = compress;
+    }
+
+    SheetDataWriter createSheetDataWriter() throws IOException {
+        if(_compressTmpFiles) {
+            return new GZIPSheetDataWriter();
+        } else {
+            return new SheetDataWriter();
+        }
+    }
+
     XSSFSheet getXSSFSheet(SXSSFSheet sheet)
     {
         XSSFSheet result=_sxFromXHash.get(sheet);
diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java
new file mode 100644 (file)
index 0000000..ec733a1
--- /dev/null
@@ -0,0 +1,300 @@
+/*\r
+ *  ====================================================================\r
+ *    Licensed to the Apache Software Foundation (ASF) under one or more\r
+ *    contributor license agreements.  See the NOTICE file distributed with\r
+ *    this work for additional information regarding copyright ownership.\r
+ *    The ASF licenses this file to You under the Apache License, Version 2.0\r
+ *    (the "License"); you may not use this file except in compliance with\r
+ *    the License.  You may obtain a copy of the License at\r
+ *\r
+ *        http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *    Unless required by applicable law or agreed to in writing, software\r
+ *    distributed under the License is distributed on an "AS IS" BASIS,\r
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *    See the License for the specific language governing permissions and\r
+ *    limitations under the License.\r
+ * ====================================================================\r
+ */\r
+\r
+package org.apache.poi.xssf.streaming;\r
+\r
+import org.apache.poi.ss.usermodel.Cell;\r
+import org.apache.poi.ss.usermodel.CellStyle;\r
+import org.apache.poi.ss.usermodel.FormulaError;\r
+import org.apache.poi.ss.util.CellReference;\r
+\r
+import java.io.*;\r
+import java.util.Iterator;\r
+\r
+/**\r
+ * Initially copied from BigGridDemo "SpreadsheetWriter".\r
+ * Unlike the original code which wrote the entire document,\r
+ * this class only writes the "sheetData" document fragment\r
+ * so that it was renamed to "SheetDataWriter"\r
+ */\r
+public class SheetDataWriter {\r
+    private final File _fd;\r
+    private final Writer _out;\r
+    private int _rownum;\r
+    private boolean _rowContainedNullCells = false;\r
+    int _numberOfFlushedRows;\r
+    int _lowestIndexOfFlushedRows; // meaningful only of _numberOfFlushedRows>0\r
+    int _numberOfCellsOfLastFlushedRow; // meaningful only of _numberOfFlushedRows>0\r
+\r
+    public SheetDataWriter() throws IOException {\r
+        _fd = createTempFile();\r
+        _out = createWriter(_fd);\r
+    }\r
+\r
+    /**\r
+     * Create a temp file to write sheet data. \r
+     * By default, temp files are created in the default temporary-file directory\r
+     * with a prefix "poi-sxssf-sheet" and suffix ".xml".  Subclasses can override \r
+     * it and specify a different temp directory or filename or suffix, e.g. <code>.gz</code>\r
+     * \r
+     * @return temp file to write sheet data\r
+     */\r
+    public File createTempFile()throws IOException {\r
+        File fd = File.createTempFile("poi-sxssf-sheet", ".xml");\r
+        fd.deleteOnExit();\r
+        return fd;\r
+    }\r
+\r
+    /**\r
+     * Create a writer for the sheet data.\r
+     * \r
+     * @param  fd the file to write to\r
+     * @return\r
+     */\r
+    public Writer createWriter(File fd)throws IOException {\r
+        return new BufferedWriter(new FileWriter(fd));\r
+    }\r
+\r
+    /**\r
+     * flush and close the temp data writer. \r
+     * This method <em>must</em> be invoked before calling {@link #getWorksheetXMLInputStream()}\r
+     */\r
+    public void close() throws IOException{\r
+        _out.flush();\r
+        _out.close();\r
+    }\r
+\r
+    File getTempFile(){\r
+        return _fd;\r
+    }\r
+    \r
+    /**\r
+     * @return a stream to read temp file with the sheet data\r
+     */\r
+    public InputStream getWorksheetXMLInputStream() throws IOException {\r
+        File fd = getTempFile();\r
+        return new FileInputStream(fd);\r
+    }\r
+\r
+    public int getNumberOfFlushedRows() {\r
+        return _numberOfFlushedRows;\r
+    }\r
+\r
+    public int getNumberOfCellsOfLastFlushedRow() {\r
+        return _numberOfCellsOfLastFlushedRow;\r
+    }\r
+\r
+    public int getLowestIndexOfFlushedRows() {\r
+        return _lowestIndexOfFlushedRows;\r
+    }\r
+\r
+    protected void finalize() throws Throwable {\r
+        _fd.delete();\r
+    }\r
+\r
+    /**\r
+     * Write a row to the file\r
+     *\r
+     * @param rownum 0-based row number\r
+     * @param row    a row\r
+     */\r
+    public void writeRow(int rownum, SXSSFRow row) throws IOException {\r
+        if (_numberOfFlushedRows == 0)\r
+            _lowestIndexOfFlushedRows = rownum;\r
+        _numberOfCellsOfLastFlushedRow = row.getLastCellNum();\r
+        _numberOfFlushedRows++;\r
+        beginRow(rownum, row);\r
+        Iterator<Cell> cells = row.allCellsIterator();\r
+        int columnIndex = 0;\r
+        while (cells.hasNext()) {\r
+            writeCell(columnIndex++, cells.next());\r
+        }\r
+        endRow();\r
+    }\r
+\r
+    void beginRow(int rownum, SXSSFRow row) throws IOException {\r
+        _out.write("<row r=\"" + (rownum + 1) + "\"");\r
+        if (row.hasCustomHeight())\r
+            _out.write(" customHeight=\"true\"  ht=\"" + row.getHeightInPoints() + "\"");\r
+        if (row.getZeroHeight())\r
+            _out.write(" hidden=\"true\"");\r
+        if (row.isFormatted()) {\r
+            _out.write(" s=\"" + row._style + "\"");\r
+            _out.write(" customFormat=\"1\"");\r
+        }\r
+        _out.write(">\n");\r
+        this._rownum = rownum;\r
+        _rowContainedNullCells = false;\r
+    }\r
+\r
+    void endRow() throws IOException {\r
+        _out.write("</row>\n");\r
+    }\r
+\r
+    public void writeCell(int columnIndex, Cell cell) throws IOException {\r
+        if (cell == null) {\r
+            _rowContainedNullCells = true;\r
+            return;\r
+        }\r
+        String ref = new CellReference(_rownum, columnIndex).formatAsString();\r
+        _out.write("<c r=\"" + ref + "\"");\r
+        CellStyle cellStyle = cell.getCellStyle();\r
+        if (cellStyle.getIndex() != 0) _out.write(" s=\"" + cellStyle.getIndex() + "\"");\r
+        int cellType = cell.getCellType();\r
+        switch (cellType) {\r
+            case Cell.CELL_TYPE_BLANK: {\r
+                _out.write(">");\r
+                break;\r
+            }\r
+            case Cell.CELL_TYPE_FORMULA: {\r
+                _out.write(">");\r
+                _out.write("<f>");\r
+                outputQuotedString(cell.getCellFormula());\r
+                _out.write("</f>");\r
+                switch (cell.getCachedFormulaResultType()) {\r
+                    case Cell.CELL_TYPE_NUMERIC:\r
+                        double nval = cell.getNumericCellValue();\r
+                        if (!Double.isNaN(nval)) {\r
+                            _out.write("<v>" + nval + "</v>");\r
+                        }\r
+                        break;\r
+                }\r
+                break;\r
+            }\r
+            case Cell.CELL_TYPE_STRING: {\r
+                _out.write(" t=\"inlineStr\">");\r
+                _out.write("<is><t>");\r
+                outputQuotedString(cell.getStringCellValue());\r
+                _out.write("</t></is>");\r
+                break;\r
+            }\r
+            case Cell.CELL_TYPE_NUMERIC: {\r
+                _out.write(" t=\"n\">");\r
+                _out.write("<v>" + cell.getNumericCellValue() + "</v>");\r
+                break;\r
+            }\r
+            case Cell.CELL_TYPE_BOOLEAN: {\r
+                _out.write(" t=\"b\">");\r
+                _out.write("<v>" + (cell.getBooleanCellValue() ? "1" : "0") + "</v>");\r
+                break;\r
+            }\r
+            case Cell.CELL_TYPE_ERROR: {\r
+                FormulaError error = FormulaError.forInt(cell.getErrorCellValue());\r
+\r
+                _out.write(" t=\"e\">");\r
+                _out.write("<v>" + error.getString() + "</v>");\r
+                break;\r
+            }\r
+            default: {\r
+                assert false;\r
+                throw new RuntimeException("Huh?");\r
+            }\r
+        }\r
+        _out.write("</c>");\r
+    }\r
+\r
+    //Taken from jdk1.3/src/javax/swing/text/html/HTMLWriter.java\r
+    protected void outputQuotedString(String s) throws IOException {\r
+        if (s == null || s.length() == 0) {\r
+            return;\r
+        }\r
+\r
+        char[] chars = s.toCharArray();\r
+        int last = 0;\r
+        int length = s.length();\r
+        for (int counter = 0; counter < length; counter++) {\r
+            char c = chars[counter];\r
+            switch (c) {\r
+                case '<':\r
+                    if (counter > last) {\r
+                        _out.write(chars, last, counter - last);\r
+                    }\r
+                    last = counter + 1;\r
+                    _out.write("&lt;");\r
+                    break;\r
+                case '>':\r
+                    if (counter > last) {\r
+                        _out.write(chars, last, counter - last);\r
+                    }\r
+                    last = counter + 1;\r
+                    _out.write("&gt;");\r
+                    break;\r
+                case '&':\r
+                    if (counter > last) {\r
+                        _out.write(chars, last, counter - last);\r
+                    }\r
+                    last = counter + 1;\r
+                    _out.write("&amp;");\r
+                    break;\r
+                case '"':\r
+                    if (counter > last) {\r
+                        _out.write(chars, last, counter - last);\r
+                    }\r
+                    last = counter + 1;\r
+                    _out.write("&quot;");\r
+                    break;\r
+                // Special characters\r
+                case '\n':\r
+                    if (counter > last) {\r
+                        _out.write(chars, last, counter - last);\r
+                    }\r
+                    _out.write("&#xa;");\r
+                    last = counter + 1;\r
+                    break;\r
+                case '\t':\r
+                    if (counter > last) {\r
+                        _out.write(chars, last, counter - last);\r
+                    }\r
+                    _out.write("&#x9;");\r
+                    last = counter + 1;\r
+                    break;\r
+                case '\r':\r
+                    if (counter > last) {\r
+                        _out.write(chars, last, counter - last);\r
+                    }\r
+                    _out.write("&#xd;");\r
+                    last = counter + 1;\r
+                    break;\r
+                case 0xa0:\r
+                    if (counter > last) {\r
+                        _out.write(chars, last, counter - last);\r
+                    }\r
+                    _out.write("&#xa0;");\r
+                    last = counter + 1;\r
+                    break;\r
+                default:\r
+                    if (c < ' ' || c > 127) {\r
+                        if (counter > last) {\r
+                            _out.write(chars, last, counter - last);\r
+                        }\r
+                        last = counter + 1;\r
+                        // If the character is outside of ascii, write the\r
+                        // numeric value.\r
+                        _out.write("&#");\r
+                        _out.write(String.valueOf((int) c));\r
+                        _out.write(";");\r
+                    }\r
+                    break;\r
+            }\r
+        }\r
+        if (last < length) {\r
+            _out.write(chars, last, length - last);\r
+        }\r
+    }\r
+}\r
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFCell.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFCell.java
new file mode 100644 (file)
index 0000000..119a51e
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ *  ====================================================================
+ *    Licensed to the Apache Software Foundation (ASF) under one or more
+ *    contributor license agreements.  See the NOTICE file distributed with
+ *    this work for additional information regarding copyright ownership.
+ *    The ASF licenses this file to You under the Apache License, Version 2.0
+ *    (the "License"); you may not use this file except in compliance with
+ *    the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ * ====================================================================
+ */
+
+package org.apache.poi.xssf.streaming;
+
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.xssf.SXSSFITestDataProvider;
+
+/**
+ *
+ */
+public class TestSXSSFCell extends BaseTestCell {
+
+    public TestSXSSFCell() {
+        super(SXSSFITestDataProvider.instance);
+    }
+
+    /**
+     * this test involves evaluation of formulas which isn't supported for SXSSF
+     */
+    @Override
+    public void testConvertStringFormulaCell() {
+        try {
+            super.testConvertStringFormulaCell();
+            fail("expected exception");
+        } catch (IllegalArgumentException e){
+            assertEquals(
+                    "Unexpected type of cell: class org.apache.poi.xssf.streaming.SXSSFCell. " +
+                    "Only XSSFCells can be evaluated.", e.getMessage());
+        }
+    }
+
+    /**
+     * this test involves evaluation of formulas which isn't supported for SXSSF
+     */
+    @Override
+    public void testSetTypeStringOnFormulaCell() {
+        try {
+            super.testSetTypeStringOnFormulaCell();
+            fail("expected exception");
+        } catch (IllegalArgumentException e){
+            assertEquals(
+                    "Unexpected type of cell: class org.apache.poi.xssf.streaming.SXSSFCell. " +
+                    "Only XSSFCells can be evaluated.", e.getMessage());
+        }
+    }
+
+    public void testXmlEncoding(){
+        Workbook wb = _testDataProvider.createWorkbook();
+        Sheet sh = wb.createSheet();
+        Row row = sh.createRow(0);
+        Cell cell = row.createCell(0);
+        String sval = "<>\t\r\n\u00a0 &\"POI\'\u2122";
+        cell.setCellValue(sval);
+
+        wb = _testDataProvider.writeOutAndReadBack(wb);
+
+        assertEquals(sval, wb.getSheetAt(0).getRow(0).getCell(0).getStringCellValue());
+
+    }
+}
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFHyperlink.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFHyperlink.java
new file mode 100644 (file)
index 0000000..7184e51
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ *  ====================================================================
+ *    Licensed to the Apache Software Foundation (ASF) under one or more
+ *    contributor license agreements.  See the NOTICE file distributed with
+ *    this work for additional information regarding copyright ownership.
+ *    The ASF licenses this file to You under the Apache License, Version 2.0
+ *    (the "License"); you may not use this file except in compliance with
+ *    the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ * ====================================================================
+ */
+
+package org.apache.poi.xssf.streaming;
+
+import org.apache.poi.ss.usermodel.BaseTestHyperlink;
+import org.apache.poi.xssf.SXSSFITestDataProvider;
+
+/**
+ * Test setting hyperlinks in SXSSF
+ *
+ * @author Yegor Kozlov
+ */
+public class TestSXSSFHyperlink extends BaseTestHyperlink {
+
+    public TestSXSSFHyperlink() {
+        super(SXSSFITestDataProvider.instance);
+    }
+
+}
\ No newline at end of file
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFRow.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFRow.java
new file mode 100644 (file)
index 0000000..2a3e069
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ *  ====================================================================
+ *    Licensed to the Apache Software Foundation (ASF) under one or more
+ *    contributor license agreements.  See the NOTICE file distributed with
+ *    this work for additional information regarding copyright ownership.
+ *    The ASF licenses this file to You under the Apache License, Version 2.0
+ *    (the "License"); you may not use this file except in compliance with
+ *    the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ * ====================================================================
+ */
+
+package org.apache.poi.xssf.streaming;
+
+import org.apache.poi.ss.usermodel.BaseTestRow;
+import org.apache.poi.xssf.SXSSFITestDataProvider;
+
+/**
+ * Tests for XSSFRow
+ */
+public final class TestSXSSFRow extends BaseTestRow {
+
+    public TestSXSSFRow() {
+        super(SXSSFITestDataProvider.instance);
+    }
+}
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFSheet.java
new file mode 100644 (file)
index 0000000..f9d8fc0
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ *  ====================================================================
+ *    Licensed to the Apache Software Foundation (ASF) under one or more
+ *    contributor license agreements.  See the NOTICE file distributed with
+ *    this work for additional information regarding copyright ownership.
+ *    The ASF licenses this file to You under the Apache License, Version 2.0
+ *    (the "License"); you may not use this file except in compliance with
+ *    the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ * ====================================================================
+ */
+
+package org.apache.poi.xssf.streaming;
+
+import org.apache.poi.ss.usermodel.BaseTestSheet;
+import org.apache.poi.xssf.SXSSFITestDataProvider;
+
+
+public class TestSXSSFSheet extends BaseTestSheet {
+
+    public TestSXSSFSheet() {
+        super(SXSSFITestDataProvider.instance);
+    }
+
+    /**
+     * cloning of sheets is not supported in SXSSF
+     */
+    @Override
+    public void testCloneSheet() {
+        try {
+            super.testCloneSheet();
+            fail("expected exception");
+        } catch (RuntimeException e){
+            assertEquals("NotImplemented", e.getMessage());
+        }
+    }
+
+    @Override
+    public void testCloneSheetMultipleTimes() {
+        try {
+            super.testCloneSheetMultipleTimes();
+            fail("expected exception");
+        } catch (RuntimeException e){
+            assertEquals("NotImplemented", e.getMessage());
+        }
+    }
+    /**
+     * shifting rows is not supported in SXSSF
+     */
+    @Override
+    public void testShiftMerged(){
+        try {
+            super.testShiftMerged();
+            fail("expected exception");
+        } catch (RuntimeException e){
+            assertEquals("NotImplemented", e.getMessage());
+        }
+    }
+
+    /**
+     *  Bug 35084: cloning cells with formula
+     *
+     *  The test is disabled because cloning of sheets is not supported in SXSSF
+     */
+    @Override
+    public void test35084(){
+        try {
+            super.test35084();
+            fail("expected exception");
+        } catch (RuntimeException e){
+            assertEquals("NotImplemented", e.getMessage());
+        }
+    }
+
+    @Override
+    public void testDefaultColumnStyle() {
+        //TODO column styles are not yet supported by XSSF
+    }
+}
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java b/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFWorkbook.java
new file mode 100644 (file)
index 0000000..6d7d127
--- /dev/null
@@ -0,0 +1,200 @@
+/*
+ *  ====================================================================
+ *    Licensed to the Apache Software Foundation (ASF) under one or more
+ *    contributor license agreements.  See the NOTICE file distributed with
+ *    this work for additional information regarding copyright ownership.
+ *    The ASF licenses this file to You under the Apache License, Version 2.0
+ *    (the "License"); you may not use this file except in compliance with
+ *    the License.  You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ * ====================================================================
+ */
+
+package org.apache.poi.xssf.streaming;
+
+import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.util.CellReference;
+import org.apache.poi.xssf.SXSSFITestDataProvider;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+
+import java.io.File;
+
+public final class TestSXSSFWorkbook extends BaseTestWorkbook {
+
+       public TestSXSSFWorkbook() {
+               super(SXSSFITestDataProvider.instance);
+       }
+
+    /**
+     * cloning of sheets is not supported in SXSSF
+     */
+    @Override
+    public void testCloneSheet() {
+        try {
+            super.testCloneSheet();
+            fail("expected exception");
+        } catch (RuntimeException e){
+            assertEquals("NotImplemented", e.getMessage());
+        }
+    }
+
+    /**
+     * this test involves evaluation of formulas which isn't supported for SXSSF
+     */
+    @Override
+    public void testSetSheetName() {
+        try {
+            super.testSetSheetName();
+            fail("expected exception");
+        } catch (Exception e){
+            assertEquals(
+                    "Unexpected type of cell: class org.apache.poi.xssf.streaming.SXSSFCell. " +
+                    "Only XSSFCells can be evaluated.", e.getMessage());
+        }
+    }
+    
+    public void testExistingWorkbook() {
+       XSSFWorkbook xssfWorkbook = new XSSFWorkbook();
+       xssfWorkbook.createSheet("S1");
+       SXSSFWorkbook wb = new SXSSFWorkbook(xssfWorkbook);
+       xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
+       wb = new SXSSFWorkbook(xssfWorkbook);
+       assertEquals(1, wb.getNumberOfSheets());
+       Sheet sheet  = wb.getSheetAt(0);
+       assertNotNull(sheet);
+       assertEquals("S1", sheet.getSheetName());
+    }
+    
+    public void testAddToExistingWorkbook() {
+       XSSFWorkbook xssfWorkbook = new XSSFWorkbook();
+       xssfWorkbook.createSheet("S1");
+       Sheet sheet = xssfWorkbook.createSheet("S2");
+       Row row = sheet.createRow(1);
+       Cell cell = row.createCell(1);
+       cell.setCellValue("value 2_1_1");
+       SXSSFWorkbook wb = new SXSSFWorkbook(xssfWorkbook);
+       xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
+       wb = new SXSSFWorkbook(xssfWorkbook);
+       
+       // Add a row to the existing empty sheet
+       Sheet sheet1 = wb.getSheetAt(0);
+       Row row1_1 = sheet1.createRow(1);
+       Cell cell1_1_1 = row1_1.createCell(1);
+       cell1_1_1.setCellValue("value 1_1_1");
+       
+       // Add a row to the existing non-empty sheet
+       Sheet sheet2 = wb.getSheetAt(1);
+       Row row2_2 = sheet2.createRow(2);
+       Cell cell2_2_1 = row2_2.createCell(1);
+       cell2_2_1.setCellValue("value 2_2_1");
+       
+       // Add a sheet with one row
+       Sheet sheet3 = wb.createSheet("S3");
+       Row row3_1 = sheet3.createRow(1);
+       Cell cell3_1_1 = row3_1.createCell(1);
+       cell3_1_1.setCellValue("value 3_1_1");
+       
+       xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
+       assertEquals(3, xssfWorkbook.getNumberOfSheets());
+       // Verify sheet 1
+       sheet1 = xssfWorkbook.getSheetAt(0);
+       assertEquals("S1", sheet1.getSheetName());
+       assertEquals(1, sheet1.getPhysicalNumberOfRows());
+       row1_1 = sheet1.getRow(1);
+       assertNotNull(row1_1);
+       cell1_1_1 = row1_1.getCell(1);
+       assertNotNull(cell1_1_1);
+       assertEquals("value 1_1_1", cell1_1_1.getStringCellValue());
+       // Verify sheet 2
+       sheet2 = xssfWorkbook.getSheetAt(1);
+       assertEquals("S2", sheet2.getSheetName());
+       assertEquals(2, sheet2.getPhysicalNumberOfRows());
+       Row row2_1 = sheet2.getRow(1);
+       assertNotNull(row2_1);
+       Cell cell2_1_1 = row2_1.getCell(1);
+       assertNotNull(cell2_1_1);
+       assertEquals("value 2_1_1", cell2_1_1.getStringCellValue());
+       row2_2 = sheet2.getRow(2);
+       assertNotNull(row2_2);
+       cell2_2_1 = row2_2.getCell(1);
+       assertNotNull(cell2_2_1);
+       assertEquals("value 2_2_1", cell2_2_1.getStringCellValue());
+       // Verify sheet 3
+       sheet3 = xssfWorkbook.getSheetAt(2);
+       assertEquals("S3", sheet3.getSheetName());
+       assertEquals(1, sheet3.getPhysicalNumberOfRows());
+       row3_1 = sheet3.getRow(1);
+       assertNotNull(row3_1);
+       cell3_1_1 = row3_1.getCell(1);
+       assertNotNull(cell3_1_1);
+       assertEquals("value 3_1_1", cell3_1_1.getStringCellValue());
+    }
+
+    public void testSheetdataWriter(){
+        SXSSFWorkbook wb = new SXSSFWorkbook();
+        SXSSFSheet sh = (SXSSFSheet)wb.createSheet();
+        SheetDataWriter wr = sh.getSheetDataWriter();
+        assertTrue(wr.getClass() == SheetDataWriter.class);
+        File tmp = wr.getTempFile();
+        assertTrue(tmp.getName().startsWith("poi-sxssf-sheet"));
+        assertTrue(tmp.getName().endsWith(".xml"));
+
+        wb = new SXSSFWorkbook();
+        wb.setCompressTempFiles(true);
+        sh = (SXSSFSheet)wb.createSheet();
+        wr = sh.getSheetDataWriter();
+        assertTrue(wr.getClass() == GZIPSheetDataWriter.class);
+        tmp = wr.getTempFile();
+        assertTrue(tmp.getName().startsWith("poi-sxssf-sheet-xml"));
+        assertTrue(tmp.getName().endsWith(".gz"));
+    }
+    
+    public void testGZipSheetdataWriter(){
+        Workbook wb = new SXSSFWorkbook();
+        ((SXSSFWorkbook)wb).setCompressTempFiles(true);
+        int rowNum = 10000;
+        int sheetNum = 5;
+        for(int i = 0; i < sheetNum; i++){
+            Sheet sh = wb.createSheet("sheet" + i);
+            for(int j = 0; j < rowNum; j++){
+                Row row = sh.createRow(j);
+                Cell cell1 = row.createCell(0);
+                cell1.setCellValue(new CellReference(cell1).formatAsString());
+                
+                Cell cell2 = row.createCell(1);
+                cell2.setCellValue(i);
+
+                Cell cell3 = row.createCell(2);
+                cell3.setCellValue(j);
+            }
+        }
+
+        wb = SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
+        for(int i = 0; i < sheetNum; i++){
+            Sheet sh = wb.getSheetAt(i);
+            assertEquals("sheet" + i, sh.getSheetName());
+            for(int j = 0; j < rowNum; j++){
+                Row row = sh.getRow(j);
+                assertNotNull("row[" + j + "]", row);
+                Cell cell1 = row.getCell(0);
+                assertEquals(new CellReference(cell1).formatAsString(), cell1.getStringCellValue());
+
+                Cell cell2 = row.getCell(1);
+                assertEquals(i, (int)cell2.getNumericCellValue());
+
+                Cell cell3 = row.getCell(2);
+                assertEquals(j, (int)cell3.getNumericCellValue());
+            }
+        }
+
+        
+    }
+
+}
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFCell.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFCell.java
deleted file mode 100755 (executable)
index 1f1f1be..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *  ====================================================================
- *    Licensed to the Apache Software Foundation (ASF) under one or more
- *    contributor license agreements.  See the NOTICE file distributed with
- *    this work for additional information regarding copyright ownership.
- *    The ASF licenses this file to You under the Apache License, Version 2.0
- *    (the "License"); you may not use this file except in compliance with
- *    the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- * ====================================================================
- */
-
-package org.apache.poi.xssf.usermodel.streaming;
-
-import org.apache.poi.ss.usermodel.*;
-import org.apache.poi.xssf.SXSSFITestDataProvider;
-
-/**
- *
- */
-public class TestSXSSFCell extends BaseTestCell {
-
-    public TestSXSSFCell() {
-        super(SXSSFITestDataProvider.instance);
-    }
-
-    /**
-     * this test involves evaluation of formulas which isn't supported for SXSSF
-     */
-    @Override
-    public void testConvertStringFormulaCell() {
-        try {
-            super.testConvertStringFormulaCell();
-            fail("expected exception");
-        } catch (IllegalArgumentException e){
-            assertEquals(
-                    "Unexpected type of cell: class org.apache.poi.xssf.streaming.SXSSFCell. " +
-                    "Only XSSFCells can be evaluated.", e.getMessage());
-        }
-    }
-
-    /**
-     * this test involves evaluation of formulas which isn't supported for SXSSF
-     */
-    @Override
-    public void testSetTypeStringOnFormulaCell() {
-        try {
-            super.testSetTypeStringOnFormulaCell();
-            fail("expected exception");
-        } catch (IllegalArgumentException e){
-            assertEquals(
-                    "Unexpected type of cell: class org.apache.poi.xssf.streaming.SXSSFCell. " +
-                    "Only XSSFCells can be evaluated.", e.getMessage());
-        }
-    }
-
-    public void testXmlEncoding(){
-        Workbook wb = _testDataProvider.createWorkbook();
-        Sheet sh = wb.createSheet();
-        Row row = sh.createRow(0);
-        Cell cell = row.createCell(0);
-        String sval = "<>\t\r\n\u00a0 &\"POI\'\u2122";
-        cell.setCellValue(sval);
-
-        wb = _testDataProvider.writeOutAndReadBack(wb);
-
-        assertEquals(sval, wb.getSheetAt(0).getRow(0).getCell(0).getStringCellValue());
-
-    }
-}
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFHyperlink.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFHyperlink.java
deleted file mode 100755 (executable)
index ed8b91b..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  ====================================================================
- *    Licensed to the Apache Software Foundation (ASF) under one or more
- *    contributor license agreements.  See the NOTICE file distributed with
- *    this work for additional information regarding copyright ownership.
- *    The ASF licenses this file to You under the Apache License, Version 2.0
- *    (the "License"); you may not use this file except in compliance with
- *    the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- * ====================================================================
- */
-
-package org.apache.poi.xssf.usermodel.streaming;
-
-import org.apache.poi.ss.usermodel.BaseTestCell;
-import org.apache.poi.ss.usermodel.BaseTestHyperlink;
-import org.apache.poi.xssf.SXSSFITestDataProvider;
-
-/**
- * Test setting hyperlinks in SXSSF
- *
- * @author Yegor Kozlov
- */
-public class TestSXSSFHyperlink extends BaseTestHyperlink {
-
-    public TestSXSSFHyperlink() {
-        super(SXSSFITestDataProvider.instance);
-    }
-
-}
\ No newline at end of file
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFRow.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFRow.java
deleted file mode 100755 (executable)
index 9e20fc7..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  ====================================================================
- *    Licensed to the Apache Software Foundation (ASF) under one or more
- *    contributor license agreements.  See the NOTICE file distributed with
- *    this work for additional information regarding copyright ownership.
- *    The ASF licenses this file to You under the Apache License, Version 2.0
- *    (the "License"); you may not use this file except in compliance with
- *    the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- * ====================================================================
- */
-
-package org.apache.poi.xssf.usermodel.streaming;
-
-import org.apache.poi.ss.usermodel.BaseTestRow;
-import org.apache.poi.xssf.SXSSFITestDataProvider;
-
-/**
- * Tests for XSSFRow
- */
-public final class TestSXSSFRow extends BaseTestRow {
-
-    public TestSXSSFRow() {
-        super(SXSSFITestDataProvider.instance);
-    }
-}
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFSheet.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFSheet.java
deleted file mode 100755 (executable)
index 3feb8c2..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- *  ====================================================================
- *    Licensed to the Apache Software Foundation (ASF) under one or more
- *    contributor license agreements.  See the NOTICE file distributed with
- *    this work for additional information regarding copyright ownership.
- *    The ASF licenses this file to You under the Apache License, Version 2.0
- *    (the "License"); you may not use this file except in compliance with
- *    the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- * ====================================================================
- */
-
-package org.apache.poi.xssf.usermodel.streaming;
-
-import org.apache.poi.ss.usermodel.BaseTestSheet;
-import org.apache.poi.xssf.SXSSFITestDataProvider;
-
-
-public class TestSXSSFSheet extends BaseTestSheet {
-
-    public TestSXSSFSheet() {
-        super(SXSSFITestDataProvider.instance);
-    }
-
-    /**
-     * cloning of sheets is not supported in SXSSF
-     */
-    @Override
-    public void testCloneSheet() {
-        try {
-            super.testCloneSheet();
-            fail("expected exception");
-        } catch (RuntimeException e){
-            assertEquals("NotImplemented", e.getMessage());
-        }
-    }
-
-    @Override
-    public void testCloneSheetMultipleTimes() {
-        try {
-            super.testCloneSheetMultipleTimes();
-            fail("expected exception");
-        } catch (RuntimeException e){
-            assertEquals("NotImplemented", e.getMessage());
-        }
-    }
-    /**
-     * shifting rows is not supported in SXSSF
-     */
-    @Override
-    public void testShiftMerged(){
-        try {
-            super.testShiftMerged();
-            fail("expected exception");
-        } catch (RuntimeException e){
-            assertEquals("NotImplemented", e.getMessage());
-        }
-    }
-
-    /**
-     *  Bug 35084: cloning cells with formula
-     *
-     *  The test is disabled because cloning of sheets is not supported in SXSSF
-     */
-    @Override
-    public void test35084(){
-        try {
-            super.test35084();
-            fail("expected exception");
-        } catch (RuntimeException e){
-            assertEquals("NotImplemented", e.getMessage());
-        }
-    }
-
-    @Override
-    public void testDefaultColumnStyle() {
-        //TODO column styles are not yet supported by XSSF
-    }
-}
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFWorkbook.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/streaming/TestSXSSFWorkbook.java
deleted file mode 100755 (executable)
index c8b5b61..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- *  ====================================================================
- *    Licensed to the Apache Software Foundation (ASF) under one or more
- *    contributor license agreements.  See the NOTICE file distributed with
- *    this work for additional information regarding copyright ownership.
- *    The ASF licenses this file to You under the Apache License, Version 2.0
- *    (the "License"); you may not use this file except in compliance with
- *    the License.  You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- * ====================================================================
- */
-
-package org.apache.poi.xssf.usermodel.streaming;
-
-import org.apache.poi.ss.usermodel.BaseTestWorkbook;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.xssf.SXSSFITestDataProvider;
-import org.apache.poi.xssf.streaming.SXSSFWorkbook;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
-
-public final class TestSXSSFWorkbook extends BaseTestWorkbook {
-
-       public TestSXSSFWorkbook() {
-               super(SXSSFITestDataProvider.instance);
-       }
-
-    /**
-     * cloning of sheets is not supported in SXSSF
-     */
-    @Override
-    public void testCloneSheet() {
-        try {
-            super.testCloneSheet();
-            fail("expected exception");
-        } catch (RuntimeException e){
-            assertEquals("NotImplemented", e.getMessage());
-        }
-    }
-
-    /**
-     * this test involves evaluation of formulas which isn't supported for SXSSF
-     */
-    @Override
-    public void testSetSheetName() {
-        try {
-            super.testSetSheetName();
-            fail("expected exception");
-        } catch (Exception e){
-            assertEquals(
-                    "Unexpected type of cell: class org.apache.poi.xssf.streaming.SXSSFCell. " +
-                    "Only XSSFCells can be evaluated.", e.getMessage());
-        }
-    }
-    
-    public void testExistingWorkbook() {
-       XSSFWorkbook xssfWorkbook = new XSSFWorkbook();
-       xssfWorkbook.createSheet("S1");
-       SXSSFWorkbook wb = new SXSSFWorkbook(xssfWorkbook);
-       xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
-       wb = new SXSSFWorkbook(xssfWorkbook);
-       assertEquals(1, wb.getNumberOfSheets());
-       Sheet sheet  = wb.getSheetAt(0);
-       assertNotNull(sheet);
-       assertEquals("S1", sheet.getSheetName());
-    }
-    
-    public void testAddToExistingWorkbook() {
-       XSSFWorkbook xssfWorkbook = new XSSFWorkbook();
-       xssfWorkbook.createSheet("S1");
-       Sheet sheet = xssfWorkbook.createSheet("S2");
-       Row row = sheet.createRow(1);
-       Cell cell = row.createCell(1);
-       cell.setCellValue("value 2_1_1");
-       SXSSFWorkbook wb = new SXSSFWorkbook(xssfWorkbook);
-       xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
-       wb = new SXSSFWorkbook(xssfWorkbook);
-       
-       // Add a row to the existing empty sheet
-       Sheet sheet1 = wb.getSheetAt(0);
-       Row row1_1 = sheet1.createRow(1);
-       Cell cell1_1_1 = row1_1.createCell(1);
-       cell1_1_1.setCellValue("value 1_1_1");
-       
-       // Add a row to the existing non-empty sheet
-       Sheet sheet2 = wb.getSheetAt(1);
-       Row row2_2 = sheet2.createRow(2);
-       Cell cell2_2_1 = row2_2.createCell(1);
-       cell2_2_1.setCellValue("value 2_2_1");
-       
-       // Add a sheet with one row
-       Sheet sheet3 = wb.createSheet("S3");
-       Row row3_1 = sheet3.createRow(1);
-       Cell cell3_1_1 = row3_1.createCell(1);
-       cell3_1_1.setCellValue("value 3_1_1");
-       
-       xssfWorkbook = (XSSFWorkbook) SXSSFITestDataProvider.instance.writeOutAndReadBack(wb);
-       assertEquals(3, xssfWorkbook.getNumberOfSheets());
-       // Verify sheet 1
-       sheet1 = xssfWorkbook.getSheetAt(0);
-       assertEquals("S1", sheet1.getSheetName());
-       assertEquals(1, sheet1.getPhysicalNumberOfRows());
-       row1_1 = sheet1.getRow(1);
-       assertNotNull(row1_1);
-       cell1_1_1 = row1_1.getCell(1);
-       assertNotNull(cell1_1_1);
-       assertEquals("value 1_1_1", cell1_1_1.getStringCellValue());
-       // Verify sheet 2
-       sheet2 = xssfWorkbook.getSheetAt(1);
-       assertEquals("S2", sheet2.getSheetName());
-       assertEquals(2, sheet2.getPhysicalNumberOfRows());
-       Row row2_1 = sheet2.getRow(1);
-       assertNotNull(row2_1);
-       Cell cell2_1_1 = row2_1.getCell(1);
-       assertNotNull(cell2_1_1);
-       assertEquals("value 2_1_1", cell2_1_1.getStringCellValue());
-       row2_2 = sheet2.getRow(2);
-       assertNotNull(row2_2);
-       cell2_2_1 = row2_2.getCell(1);
-       assertNotNull(cell2_2_1);
-       assertEquals("value 2_2_1", cell2_2_1.getStringCellValue());
-       // Verify sheet 3
-       sheet3 = xssfWorkbook.getSheetAt(2);
-       assertEquals("S3", sheet3.getSheetName());
-       assertEquals(1, sheet3.getPhysicalNumberOfRows());
-       row3_1 = sheet3.getRow(1);
-       assertNotNull(row3_1);
-       cell3_1_1 = row3_1.getCell(1);
-       assertNotNull(cell3_1_1);
-       assertEquals("value 3_1_1", cell3_1_1.getStringCellValue());
-    }
-}