From d1a51f76f0786c1e1c515cab362550cebd525589 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Thu, 13 Jul 2017 07:14:01 +0000 Subject: [PATCH] avoid unnecessary string concats in SXSSF SheetDataWriter git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1801806 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xssf/streaming/SXSSFWorkbook.java | 2 +- .../poi/xssf/streaming/SheetDataWriter.java | 73 ++++++++++++------- .../poi/xssf/streaming/TestSXSSFWorkbook.java | 2 +- 3 files changed, 48 insertions(+), 29 deletions(-) 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 d6e2934a6..9dcf1eaa0 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java @@ -406,7 +406,7 @@ public class SXSSFWorkbook implements Workbook { } private static void copyStreamAndInjectWorksheet(InputStream in, OutputStream out, InputStream worksheetData) throws IOException { - InputStreamReader inReader=new InputStreamReader(in,"UTF-8"); //TODO: Is it always UTF-8 or do we need to read the xml encoding declaration in the file? If not, we should perhaps use a SAX reader instead. + InputStreamReader inReader=new InputStreamReader(in,"UTF-8"); OutputStreamWriter outWriter=new OutputStreamWriter(out,"UTF-8"); boolean needsStartTag = true; int c; diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java index 4ada654b1..3158c1c39 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SheetDataWriter.java @@ -207,23 +207,27 @@ public class SheetDataWriter implements Closeable { } void beginRow(int rownum, SXSSFRow row) throws IOException { - _out.write("