Author: fanningpj
Date: Thu Oct 26 18:20:33 2023
New Revision: 1913363

URL: http://svn.apache.org/viewvc?rev=1913363&view=rev
Log:
[bug-67579] add new XWPFDocument/XMLSlideShow constructor

Modified:
    
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java
    
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java

Modified: 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java?rev=1913363&r1=1913362&r2=1913363&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java
 (original)
+++ 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xslf/usermodel/XMLSlideShow.java
 Thu Oct 26 18:20:33 2023
@@ -129,14 +129,27 @@ public class XMLSlideShow extends POIXML
     }
 
     /**
-     * @param is InputStream
+     * @param stream InputStream, which is closed after it is read
      * @throws IOException If reading data from the stream fails
      * @throws POIXMLException a RuntimeException that can be caused by 
invalid OOXML data
      * @throws IllegalStateException a number of other runtime exceptions can 
be thrown, especially if there are problems with the
      * input format
      */
-    public XMLSlideShow(InputStream is) throws IOException {
-        this(PackageHelper.open(is));
+    public XMLSlideShow(InputStream stream) throws IOException {
+        this(stream, true);
+    }
+
+    /**
+     * @param stream InputStream
+     * @param closeStream Whether to close the InputStream
+     * @throws IOException If reading data from the stream fails
+     * @throws POIXMLException a RuntimeException that can be caused by 
invalid OOXML data
+     * @throws IllegalStateException a number of other runtime exceptions can 
be thrown, especially if there are problems with the
+     * input format
+     * @since POI 5.2.5
+     */
+    public XMLSlideShow(InputStream stream, boolean closeStream) throws 
IOException {
+        this(PackageHelper.open(stream, closeStream));
     }
 
     static OPCPackage empty() {

Modified: 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java?rev=1913363&r1=1913362&r2=1913363&view=diff
==============================================================================
--- 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
 (original)
+++ 
poi/trunk/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
 Thu Oct 26 18:20:33 2023
@@ -150,14 +150,27 @@ public class XWPFDocument extends POIXML
     }
 
     /**
-     * @param is The InputStream to read data from
+     * @param stream The InputStream to read data from - the stream is closed
      * @throws IOException If reading data from the stream fails
      * @throws POIXMLException a RuntimeException that can be caused by 
invalid OOXML data
      * @throws IllegalStateException a number of other runtime exceptions can 
be thrown, especially if there are problems with the
      * input format
      */
-    public XWPFDocument(InputStream is) throws IOException {
-        super(PackageHelper.open(is));
+    public XWPFDocument(InputStream stream) throws IOException {
+        this(stream, true);
+    }
+
+    /**
+     * @param stream The InputStream to read data from
+     * @param closeStream Whether to close the InputStream
+     * @throws IOException If reading data from the stream fails
+     * @throws POIXMLException a RuntimeException that can be caused by 
invalid OOXML data
+     * @throws IllegalStateException a number of other runtime exceptions can 
be thrown, especially if there are problems with the
+     * input format
+     * @since POI 5.2.5
+     */
+    public XWPFDocument(InputStream stream, boolean closeStream) throws 
IOException {
+        super(PackageHelper.open(stream, closeStream));
 
         //build a tree of POIXMLDocumentParts, this workbook being the root
         load(XWPFFactory.getInstance());



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@poi.apache.org
For additional commands, e-mail: commits-h...@poi.apache.org

Reply via email to