Class ZipPartStore
java.lang.Object
org.docx4j.openpackaging.io3.stores.ZipPartStore
- All Implemented Interfaces:
PartStore
public class ZipPartStore extends java.lang.Object implements PartStore
Load a zipped up package from a file or input stream;
save it to some output stream.
- Since:
- 3.0
- Author:
- jharrop
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classZipPartStore.ByteArray -
Constructor Summary
Constructors Constructor Description ZipPartStore()ZipPartStore(java.io.File f)ZipPartStore(java.io.InputStream is) -
Method Summary
Modifier and Type Method Description voiddispose()voidfinishSave()Anything necessary to perfect the save operation.ZipPartStore.ByteArraygetByteArray(java.lang.String partName)This method is to facilitate updating the part without JAXB unmarshalling then marshalling.longgetPartSize(java.lang.String partName)The size of this part in bytes.java.io.InputStreamloadPart(java.lang.String partName)Returns null if the part does not exist.booleanpartExists(java.lang.String partName)voidrename(PartName oldName, PartName newName)Rename a part in the part store.voidsaveBinaryPart(Part part)voidsaveContentTypes(ContentTypeManager ctm)voidsaveCustomXmlDataStoragePart(CustomXmlDataStoragePart part)voidsaveJaxbXmlPart(JaxbXmlPart part)voidsaveXmlPart(XmlPart part)voidsetOutputStream(java.io.OutputStream os)voidsetSourcePartStore(PartStore partStore)Set this if its different to the target part store (ie this object)
-
Constructor Details
-
ZipPartStore
public ZipPartStore() -
ZipPartStore
- Throws:
Docx4JException
-
ZipPartStore
- Throws:
Docx4JException
-
-
Method Details
-
setSourcePartStore
Set this if its different to the target part store (ie this object)- Specified by:
setSourcePartStorein interfacePartStore
-
partExists
public boolean partExists(java.lang.String partName) -
loadPart
Description copied from interface:PartStoreReturns null if the part does not exist. This will happen when calling code optimistically tries to fetch a rels part (which may or may not exist). Note: JaxbXmlPart and JaxbXmlPartXPathAware both unmarshal lazily (ie can invoke this sometime after the docx is loaded). Caller (generally docx4j itself) should close the resulting InputStream after use.- Specified by:
loadPartin interfacePartStore- Returns:
- Throws:
Docx4JException
-
getPartSize
Description copied from interface:PartStoreThe size of this part in bytes. Return -1 if the part does not exist.- Specified by:
getPartSizein interfacePartStore- Returns:
- Throws:
Docx4JException
-
getByteArray
This method is to facilitate updating the part without JAXB unmarshalling then marshalling. Not intended for direct use by user code.- Parameters:
partName-- Returns:
- Throws:
Docx4JException- Since:
- 3.3.2
-
rename
Description copied from interface:PartStoreRename a part in the part store. Useful where a part is being renamed, but its content has not been loaded. (The existing approach is to manually force the content to be loaded) -
setOutputStream
public void setOutputStream(java.io.OutputStream os)- Specified by:
setOutputStreamin interfacePartStore- Parameters:
zipOutputStream- the zipOutputStream to set
-
saveContentTypes
- Specified by:
saveContentTypesin interfacePartStore- Throws:
Docx4JException
-
saveJaxbXmlPart
- Specified by:
saveJaxbXmlPartin interfacePartStore- Throws:
Docx4JException
-
saveCustomXmlDataStoragePart
- Specified by:
saveCustomXmlDataStoragePartin interfacePartStore- Throws:
Docx4JException
-
saveXmlPart
- Specified by:
saveXmlPartin interfacePartStore- Throws:
Docx4JException
-
saveBinaryPart
- Specified by:
saveBinaryPartin interfacePartStore- Throws:
Docx4JException
-
finishSave
Description copied from interface:PartStoreAnything necessary to perfect the save operation. For example,- Specified by:
finishSavein interfacePartStore- Throws:
Docx4JException
-
dispose
public void dispose()
-