From a510627ab16227e7a0e2c8b319b60f462b59b212 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Tue, 12 Nov 2013 09:51:13 +0000 Subject: [PATCH] Fix some JavaDocs, and add a generic constructor based on ZipEntrySource git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1540986 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/openxml4j/opc/ZipPackage.java | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java index bf98cdd29b..8bfec47312 100644 --- a/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java +++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/ZipPackage.java @@ -42,8 +42,8 @@ import org.apache.poi.openxml4j.opc.internal.marshallers.ZipPartMarshaller; import org.apache.poi.openxml4j.util.ZipEntrySource; import org.apache.poi.openxml4j.util.ZipFileZipEntrySource; import org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource; -import org.apache.poi.util.POILogger; import org.apache.poi.util.POILogFactory; +import org.apache.poi.util.POILogger; /** * Physical zip package. @@ -69,11 +69,13 @@ public final class ZipPackage extends Package { } /** - * Constructor. Operation not supported. + * Constructor. Opens a Zip based Open XML document from + * an InputStream. * * @param in * Zip input stream to load. * @param access + * The package access mode. * @throws IllegalArgumentException * If the specified input stream not an instance of * ZipInputStream. @@ -86,7 +88,7 @@ public final class ZipPackage extends Package { } /** - * Constructor. Opens a Zip based Open XML document. + * Constructor. Opens a Zip based Open XML document from a File. * * @param path * The path of the file to open or create. @@ -135,6 +137,23 @@ public final class ZipPackage extends Package { this.zipArchive = new ZipFileZipEntrySource(zipFile); } + /** + * Constructor. Opens a Zip based Open XML document from + * a custom ZipEntrySource, typically an open archive + * from another system + * + * @param zipEntry + * Zip data to load. + * @param access + * The package access mode. + * @throws InvalidFormatException + * If the content type part parsing encounters an error. + */ + ZipPackage(ZipEntrySource zipEntry, PackageAccess access) { + super(access); + this.zipArchive = zipEntry; + } + /** * Retrieves the parts from this package. We assume that the package has not * been yet inspect to retrieve all the parts, this method will open the -- 2.39.5