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 Details

    • loadPart

      java.io.InputStream loadPart​(java.lang.String partName) throws Docx4JException
      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

      void rename​(PartName oldName, PartName newName)
      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.UnsupportedOperationException
      The size of this part in bytes. Return -1 if the part does not exist.
      Parameters:
      partName -
      Returns:
      Throws:
      Docx4JException
      java.lang.UnsupportedOperationException
    • setOutputStream

      void setOutputStream​(java.io.OutputStream os) throws Docx4JException
      Throws:
      Docx4JException
    • saveContentTypes

      void saveContentTypes​(ContentTypeManager ctm) throws Docx4JException
      Throws:
      Docx4JException
    • saveJaxbXmlPart

      void saveJaxbXmlPart​(JaxbXmlPart part) throws Docx4JException
      Throws:
      Docx4JException
    • saveCustomXmlDataStoragePart

      void saveCustomXmlDataStoragePart​(CustomXmlDataStoragePart part) throws Docx4JException
      Throws:
      Docx4JException
    • saveXmlPart

      void saveXmlPart​(XmlPart part) throws Docx4JException
      Throws:
      Docx4JException
    • saveBinaryPart

      void saveBinaryPart​(Part part) throws Docx4JException
      Throws:
      Docx4JException
    • finishSave

      void finishSave() throws Docx4JException
      Anything necessary to perfect the save operation. For example,
      Throws:
      Docx4JException
    • setSourcePartStore

      void setSourcePartStore​(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. 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()