Class IFConcatenator


  • public class IFConcatenator
    extends java.lang.Object
    This class allows to concatenate multiple intermediate format files to a single output file in the final format. It is based on the SAX API and is therefore very fast and does not require to load the individual documents into memory as DOM documents, for example.

    Note: This class will filter/ignore any document navigation events. Support for this may be added later.

    Note: document-level extensions will only be transferred from the first document passed in. If you need to merge extensions from all the concatenated documents, you may have to merge these manually on the XML level, for example using XSLT.

    • Field Detail

      • nextPageIndex

        private int nextPageIndex
      • inFirstDocument

        private boolean inFirstDocument
    • Constructor Detail

      • IFConcatenator

        public IFConcatenator​(IFDocumentHandler targetHandler,
                              org.apache.xmlgraphics.xmp.Metadata metadata)
                       throws IFException
        Creates a new IF concatenator.
        Parameters:
        targetHandler - the target document handler
        metadata - the metadata object for the generated file (may be null)
        Throws:
        IFException - if an IF-related error occurs
    • Method Detail

      • startDocument

        private void startDocument​(org.apache.xmlgraphics.xmp.Metadata metadata)
                            throws IFException
        Throws:
        IFException
      • getTargetHandler

        protected IFDocumentHandler getTargetHandler()
        Returns the target document handler.
        Returns:
        the target document handler
      • appendDocument

        public void appendDocument​(javax.xml.transform.Source src)
                            throws javax.xml.transform.TransformerException,
                                   IFException
        Appends another intermediate format document to the current output file. All document-level content (i.e. the document header and trailer) is ignored. This method shall not be called after finish() has been called.
        Parameters:
        src - the JAXP Source identifying the input document
        Throws:
        javax.xml.transform.TransformerException - if an XML-related exception occurs during
        IFException - if an IF-related error occurs