Interface PartStore
- All Known Implementing Classes:
UnzippedPartStore,ZipPartStore
public interface PartStore
A PartStore is a connection to a repository for
a particular document/package, enabling it to
be loaded or saved.
- Since:
- 3.0
- Author:
- jharrop
-
Method Summary
Modifier and Type Method Description voiddispose()voidfinishSave()Anything necessary to perfect the save operation.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.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)Use in a save operation if the source part store (ie part store from which pkg loaded) is different to this target part store.
-
Method Details
-
loadPart
Returns 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.- Parameters:
partName-- Returns:
- Throws:
Docx4JException
-
rename
Rename 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)- Parameters:
oldName-newName-- Since:
- 8.1.4
-
getPartSize
long getPartSize(java.lang.String partName) throws Docx4JException, java.lang.UnsupportedOperationExceptionThe size of this part in bytes. Return -1 if the part does not exist.- Parameters:
partName-- Returns:
- Throws:
Docx4JExceptionjava.lang.UnsupportedOperationException
-
setOutputStream
- Throws:
Docx4JException
-
saveContentTypes
- Throws:
Docx4JException
-
saveJaxbXmlPart
- Throws:
Docx4JException
-
saveCustomXmlDataStoragePart
- Throws:
Docx4JException
-
saveXmlPart
- Throws:
Docx4JException
-
saveBinaryPart
- Throws:
Docx4JException
-
finishSave
Anything necessary to perfect the save operation. For example,- Throws:
Docx4JException
-
setSourcePartStore
Use in a save operation if the source part store (ie part store from which pkg loaded) is different to this target part store. In this case it is necessary to be able to fetch parts which hadn't need to have been loaded up until this point. -
dispose
void dispose()
-