bug 60153: move flushSheets out to its own method

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1761668 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2016-09-21 03:31:15 +00:00
parent deed3aa8d6
commit 4e864476c6

View File

@ -907,7 +907,9 @@ public class SXSSFWorkbook implements Workbook {
try {
sheet.getSheetDataWriter().close();
} catch (IOException e) {
// ignore exception here
logger.log(POILogger.WARN,
"An exception occurred while closing sheet data writer for sheet "
+ sheet.getSheetName() + ".", e);
}
}
@ -926,10 +928,7 @@ public class SXSSFWorkbook implements Workbook {
@Override
public void write(OutputStream stream) throws IOException
{
for (SXSSFSheet sheet : _xFromSxHash.values())
{
sheet.flushRows();
}
flushSheets();
//Save the template
File tmplFile = TempFile.createTempFile("poi-sxssf-template", ".xlsx");
@ -956,6 +955,13 @@ public class SXSSFWorkbook implements Workbook {
}
}
protected void flushSheets() throws IOException {
for (SXSSFSheet sheet : _xFromSxHash.values())
{
sheet.flushRows();
}
}
/**
* Dispose of temporary files backing this workbook on disk.
* Calling this method will render the workbook unusable.