Package org.apache.poi.openxml4j.opc
Class ZipPackage
- java.lang.Object
-
- org.apache.poi.openxml4j.opc.OPCPackage
-
- org.apache.poi.openxml4j.opc.ZipPackage
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,RelationshipSource
public final class ZipPackage extends OPCPackage
Physical zip package.
-
-
Field Summary
-
Fields inherited from class org.apache.poi.openxml4j.opc.OPCPackage
contentTypeManager, defaultPackageAccess, defaultPartMarshaller, isDirty, originalPackagePath, output, packageProperties, partMarshallers, partUnmarshallers, relationships
-
-
Constructor Summary
Constructors Constructor Description ZipPackage()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseImpl()Close and save the package.protected PackagePartcreatePartImpl(PackagePartName partName, java.lang.String contentType, boolean loadRelationships)Create a new MemoryPackagePart from the specified URI and content type aram partName The part URI.protected voidflushImpl()Flush the package.protected PackagePartCollectiongetPartsImpl()Retrieves the parts from this package.ZipEntrySourcegetZipArchive()Get the zip archiveprotected voidremovePartImpl(PackagePartName partName)Delete a part from the packageprotected voidrevertImpl()Close the package without saving the document.voidsaveImpl(java.io.OutputStream outputStream)Save this package into the specified stream-
Methods inherited from class org.apache.poi.openxml4j.opc.OPCPackage
addExternalRelationship, addExternalRelationship, addMarshaller, addPackagePart, addRelationship, addRelationship, addThumbnail, addThumbnail, addUnmarshaller, clearRelationships, close, containPart, create, create, create, createPart, createPart, deletePart, deletePartRecursive, ensureRelationships, flush, getPackageAccess, getPackageProperties, getPart, getPart, getParts, getPartsByContentType, getPartsByName, getPartsByRelationshipType, getRelationship, getRelationships, getRelationshipsByType, getUnusedPartIndex, hasRelationships, isRelationshipExists, open, open, open, open, open, open, openOrCreate, registerPartAndContentType, removeMarshaller, removePart, removePart, removePartRecursive, removeRelationship, removeUnmarshaller, replaceContentType, revert, save, save, unregisterPartAndContentType, validatePackage
-
-
-
-
Method Detail
-
getPartsImpl
protected PackagePartCollection getPartsImpl() throws InvalidFormatException
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 archive and look for all parts contain inside it.- Specified by:
getPartsImplin classOPCPackage- Returns:
- All parts contain in this package.
- Throws:
InvalidFormatException- if the package is not valid.
-
createPartImpl
protected PackagePart createPartImpl(PackagePartName partName, java.lang.String contentType, boolean loadRelationships)
Create a new MemoryPackagePart from the specified URI and content type aram partName The part URI.- Specified by:
createPartImplin classOPCPackage- Parameters:
contentType- The part content type.partName- URI of the part to create.- Returns:
- The newly created zip package part, else null.
-
removePartImpl
protected void removePartImpl(PackagePartName partName)
Delete a part from the package- Specified by:
removePartImplin classOPCPackage- Parameters:
partName- The URI of the part to delete.- Throws:
java.lang.IllegalArgumentException- Throws if the part URI is nulll or invalid.
-
flushImpl
protected void flushImpl()
Flush the package. Do nothing.- Specified by:
flushImplin classOPCPackage
-
closeImpl
protected void closeImpl() throws java.io.IOExceptionClose and save the package.- Specified by:
closeImplin classOPCPackage- Throws:
java.io.IOException- See Also:
OPCPackage.close()
-
revertImpl
protected void revertImpl()
Close the package without saving the document. Discard all the changes made to this package.- Specified by:
revertImplin classOPCPackage
-
saveImpl
public void saveImpl(java.io.OutputStream outputStream)
Save this package into the specified stream- Specified by:
saveImplin classOPCPackage- Parameters:
outputStream- The stream use to save this package.- See Also:
OPCPackage.save(OutputStream)
-
getZipArchive
public ZipEntrySource getZipArchive()
Get the zip archive- Returns:
- The zip archive.
-
-