From 10e607a1ce5133f75f9ef46ed5fa75c451eec4a4 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Fri, 1 Oct 2021 16:51:12 +0000 Subject: [PATCH] [bug-65609] add flushBufferedData to SXSSFSheet git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1893791 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/poi/xssf/streaming/SXSSFSheet.java | 10 ++++++++++ .../org/apache/poi/xssf/streaming/SheetDataWriter.java | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java index f782a9a554..88a6619b27 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFSheet.java @@ -1873,6 +1873,16 @@ public class SXSSFSheet implements Sheet this.flushRows(0); } + /** + * Flush all the data in the buffered stream to the temp file. + * + * @throws IOException If an I/O error occurs + */ + public void flushBufferedData() throws IOException + { + this._writer.flush(); + } + private void flushOneRow() throws IOException { Integer firstRowNum = _rows.firstKey(); diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SheetDataWriter.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SheetDataWriter.java index 973a93762e..490798adf0 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SheetDataWriter.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SheetDataWriter.java @@ -443,6 +443,10 @@ public class SheetDataWriter implements Closeable { return c < ' ' || ('\uFFFE' <= c && c <= '\uFFFF'); } + void flush() throws IOException { + this._out.flush(); + } + /** * Deletes the temporary file that backed this sheet on disk. * @return true if the file was deleted, false if it wasn't. -- 2.39.5