]> source.dussan.org Git - poi.git/commitdiff
#56537 close method for SXSSF too
authorNick Burch <nick@apache.org>
Wed, 11 Jun 2014 14:38:32 +0000 (14:38 +0000)
committerNick Burch <nick@apache.org>
Wed, 11 Jun 2014 14:38:32 +0000 (14:38 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1601917 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFWorkbook.java

index 77690c06bee394434b13bcc5aff73e434117d924..0e0f50c107bd1a2829085d5b5ab3aee23caeabac 100644 (file)
 
 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.
      *