Package org.apache.poi.openxml4j.opc
Class ZipPackagePart
java.lang.Object
org.apache.poi.openxml4j.opc.PackagePart
org.apache.poi.openxml4j.opc.ZipPackagePart
- All Implemented Interfaces:
Comparable<PackagePart>,RelationshipSource
Zip implementation of a PackagePart.
- Version:
- 1.0
- Author:
- Julien Chable
- See Also:
-
Field Summary
Fields inherited from class org.apache.poi.openxml4j.opc.PackagePart
_container, _contentType, _partName -
Constructor Summary
ConstructorsConstructorDescriptionZipPackagePart(OPCPackage container, org.apache.commons.compress.archivers.zip.ZipArchiveEntry zipEntry, PackagePartName partName, String contentType) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this part : flush this part, close the input stream and output stream.voidflush()Flush the content of this part.protected InputStreamImplementation of the getInputStream() which return the inputStream of this part zip entry.protected OutputStreamImplementation of the getOutputStream().longgetSize()org.apache.commons.compress.archivers.zip.ZipArchiveEntryGet the zip entry of this part.booleanload(InputStream ios) Load the content of this part.booleansave(OutputStream os) Save the content of this part and the associated relationships part (if this part own at least one relationship) into the specified output stream.Methods inherited from class org.apache.poi.openxml4j.opc.PackagePart
addExternalRelationship, addExternalRelationship, addRelationship, addRelationship, addRelationship, addRelationship, clear, clearRelationships, compareTo, findExistingRelation, getContentType, getContentTypeDetails, getInputStream, getOutputStream, getPackage, getPartName, getRelatedPart, getRelationship, getRelationships, getRelationshipsByType, hasRelationships, isDeleted, isRelationshipExists, isRelationshipPart, removeRelationship, setContentType, setDeleted, toString
-
Constructor Details
-
ZipPackagePart
public ZipPackagePart(OPCPackage container, org.apache.commons.compress.archivers.zip.ZipArchiveEntry zipEntry, PackagePartName partName, String contentType) throws InvalidFormatException Constructor.- Parameters:
container- The container package.zipEntry- The zip entry corresponding to this part.partName- The part name.contentType- Content type.- Throws:
InvalidFormatException- Throws if the content of this part is invalid.
-
-
Method Details
-
getZipArchive
public org.apache.commons.compress.archivers.zip.ZipArchiveEntry getZipArchive()Get the zip entry of this part.- Returns:
- The zip entry in the zip structure coresponding to this part.
-
getInputStreamImpl
Implementation of the getInputStream() which return the inputStream of this part zip entry.- Specified by:
getInputStreamImplin classPackagePart- Returns:
- Input stream of this part zip entry.
- Throws:
IOException- Throws if an IO Exception occur in the implementation method.
-
getOutputStreamImpl
Implementation of the getOutputStream(). Return null. Normally will never be called since the MemoryPackage is use instead.- Specified by:
getOutputStreamImplin classPackagePart- Returns:
- null
-
getSize
public long getSize()- Overrides:
getSizein classPackagePart- Returns:
- The length of the part in bytes, or -1 if not known
-
save
Description copied from class:PackagePartSave the content of this part and the associated relationships part (if this part own at least one relationship) into the specified output stream.- Specified by:
savein classPackagePart- Parameters:
os- Output stream to save this part.- Returns:
- boolean flag that shows if the save succeeded
- Throws:
OpenXML4JException- If any exception occur.
-
load
Description copied from class:PackagePartLoad the content of this part.- Specified by:
loadin classPackagePart- Parameters:
ios- The input stream of the content to load.- Returns:
- true if the content has been successfully loaded, else false.
-
close
Description copied from class:PackagePartClose this part : flush this part, close the input stream and output stream. After this method call, the part must be available for packaging.- Specified by:
closein classPackagePart
-
flush
Description copied from class:PackagePartFlush the content of this part. If the input stream and/or output stream as in a waiting state to read or write, the must to empty their respective buffer.- Specified by:
flushin classPackagePart
-