aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2023-10-26 18:24:03 +0000
committerPJ Fanning <fanningpj@apache.org>2023-10-26 18:24:03 +0000
commit6e680589def9bb574c5621f704932c49da82e73b (patch)
tree49ca382ed8ff87109047e955886d2840c2eaa8ad /poi-ooxml
parent89ccbec1dd0f5058413ae0bc4196c26dd7fb5fef (diff)
downloadpoi-6e680589def9bb574c5621f704932c49da82e73b.tar.gz
poi-6e680589def9bb574c5621f704932c49da82e73b.zip
[bug-67579] add new XmlVisioDocument constructor
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1913364 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/ooxml/util/PackageHelper.java2
-rw-r--r--poi-ooxml/src/main/java/org/apache/poi/xdgf/usermodel/XmlVisioDocument.java18
2 files changed, 17 insertions, 3 deletions
diff --git a/poi-ooxml/src/main/java/org/apache/poi/ooxml/util/PackageHelper.java b/poi-ooxml/src/main/java/org/apache/poi/ooxml/util/PackageHelper.java
index c70a866c12..75f4371c31 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/ooxml/util/PackageHelper.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/ooxml/util/PackageHelper.java
@@ -49,7 +49,7 @@ public final class PackageHelper {
* @throws IOException If reading data from the stream fails
*/
public static OPCPackage open(InputStream stream) throws IOException {
- return open(stream, false);
+ return open(stream, true);
}
/**
diff --git a/poi-ooxml/src/main/java/org/apache/poi/xdgf/usermodel/XmlVisioDocument.java b/poi-ooxml/src/main/java/org/apache/poi/xdgf/usermodel/XmlVisioDocument.java
index f353b26848..55e724e79b 100644
--- a/poi-ooxml/src/main/java/org/apache/poi/xdgf/usermodel/XmlVisioDocument.java
+++ b/poi-ooxml/src/main/java/org/apache/poi/xdgf/usermodel/XmlVisioDocument.java
@@ -76,8 +76,22 @@ public class XmlVisioDocument extends POIXMLDocument {
load(new XDGFFactory(_document));
}
- public XmlVisioDocument(InputStream is) throws IOException {
- this(PackageHelper.open(is));
+ /**
+ * @param stream InputStream - closed when it is read
+ * @throws IOException
+ */
+ public XmlVisioDocument(InputStream stream) throws IOException {
+ this(stream, true);
+ }
+
+ /**
+ * @param stream InputStream
+ * @param closeStream Whether to close the InputStream
+ * @throws IOException
+ * @since POI 5.2.5
+ */
+ public XmlVisioDocument(InputStream stream, boolean closeStream) throws IOException {
+ this(PackageHelper.open(stream, closeStream));
}
@Override