From b066b58e3c7c76809af8b6bfd693bdffd2fc3890 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Wed, 11 Jun 2014 14:38:32 +0000 Subject: [PATCH] #56537 close method for SXSSF too git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1601917 13f79535-47bb-0310-9956-ffa450edef68 --- .../poi/xssf/streaming/SXSSFWorkbook.java | 44 ++++++++++++------- 1 file changed, 29 insertions(+), 15 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 77690c06be..0e0f50c107 100644 --- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java @@ -17,33 +17,35 @@ package org.apache.poi.xssf.streaming; -import org.apache.poi.ss.usermodel.Workbook; -import org.apache.poi.ss.usermodel.Sheet; -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.File; +import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; -import java.io.FileOutputStream; -import java.io.File; -import java.util.*; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.zip.ZipEntry; import java.util.zip.ZipFile; 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.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.Sheet; +import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.util.CellRangeAddress; 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. @@ -792,6 +794,18 @@ public class SXSSFWorkbook implements Workbook 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. * -- 2.39.5