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 5b9c304148
commit 50c59c09c9
1 changed files with 12 additions and 6 deletions

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,11 +928,8 @@ 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");
try
@ -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.