Class MemoryPackagePart

    • Constructor Detail

      • MemoryPackagePart

        public MemoryPackagePart​(OPCPackage pack,
                                 PackagePartName partName,
                                 java.lang.String contentType,
                                 boolean loadRelationships)
                          throws InvalidFormatException
        Constructor.
        Parameters:
        pack - The owner package.
        partName - The part name.
        contentType - The content type.
        loadRelationships - Specify if the relationships will be loaded.
        Throws:
        InvalidFormatException - If the specified URI is not OPC compliant.
    • Method Detail

      • getSize

        public long getSize()
        Overrides:
        getSize in class PackagePart
        Returns:
        The length of the part in bytes, or -1 if not known
      • clear

        public void clear()
        Description copied from class: PackagePart
        Allows sub-classes to clean up before new data is added.
        Overrides:
        clear in class PackagePart
      • save

        public boolean save​(java.io.OutputStream os)
                     throws OpenXML4JException
        Description copied from class: PackagePart
        Save 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:
        save in class PackagePart
        Parameters:
        os - Output stream to save this part.
        Returns:
        boolean flag that shows if the save succeeded
        Throws:
        OpenXML4JException - If any exception occur.
      • load

        public boolean load​(java.io.InputStream ios)
                     throws InvalidFormatException
        Description copied from class: PackagePart
        Load the content of this part.
        Specified by:
        load in class PackagePart
        Parameters:
        ios - The input stream of the content to load.
        Returns:
        true if the content has been successfully loaded, else false.
        Throws:
        InvalidFormatException - Throws if the content format is invalid.
      • close

        public void close()
        Description copied from class: PackagePart
        Close 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:
        close in class PackagePart
      • flush

        public void flush()
        Description copied from class: PackagePart
        Flush 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:
        flush in class PackagePart