#56537 close method for SXSSF too

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1601917 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2014-06-11 14:38:32 +00:00
parent 72054fb08d
commit b066b58e3c
1 changed files with 29 additions and 15 deletions

View File

@ -17,33 +17,35 @@
package org.apache.poi.xssf.streaming; package org.apache.poi.xssf.streaming;
import org.apache.poi.ss.usermodel.Workbook; import java.io.File;
import org.apache.poi.ss.usermodel.Sheet; import java.io.FileOutputStream;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Name;
import org.apache.poi.ss.usermodel.DataFormat;
import org.apache.poi.ss.usermodel.PictureData;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.FileOutputStream; import java.util.Enumeration;
import java.io.File; import java.util.HashMap;
import java.util.*; import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream; import java.util.zip.ZipOutputStream;
import java.util.zip.ZipEntry;
import org.apache.poi.openxml4j.opc.OPCPackage;
import org.apache.poi.ss.formula.udf.UDFFinder; import org.apache.poi.ss.formula.udf.UDFFinder;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.DataFormat;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.Name;
import org.apache.poi.ss.usermodel.PictureData;
import org.apache.poi.ss.usermodel.Row.MissingCellPolicy; import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.model.SharedStringsTable; import org.apache.poi.xssf.model.SharedStringsTable;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
/** /**
* Streaming version of XSSFWorkbook implementing the "BigGridDemo" strategy. * Streaming version of XSSFWorkbook implementing the "BigGridDemo" strategy.
@ -792,6 +794,18 @@ public class SXSSFWorkbook implements Workbook
return _wb.getCellStyleAt(idx); return _wb.getCellStyleAt(idx);
} }
/**
* Closes the underlying {@link XSSFWorkbook} and {@link OPCPackage}
* on which this Workbook is based, if any. Has no effect on Worbooks
* created from scratch.
*/
@Override
public void close() throws IOException {
// Tell the base workbook to close, does nothing if
// it's a newly created one
_wb.close();
}
/** /**
* Write out this workbook to an Outputstream. * Write out this workbook to an Outputstream.
* *