org.apache.fop.render.intermediate.util

## Class IFConcatenator

- java.lang.Object
- - org.apache.fop.render.intermediate.util.IFConcatenator

-     public class IFConcatenator
      extends 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.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IFConcatenator(IFDocumentHandler targetHandler, org.apache.xmlgraphics.xmp.Metadata metadata)` Creates a new IF concatenator.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `appendDocument(Source src)` Appends another intermediate format document to the current output file.
    `void` | `finish()` Properly finishes the current output file by creating an empty document trailer and calling `IFDocumentHandler.endDocument()`.
    `protected IFDocumentHandler` | `getTargetHandler()` Returns the target document handler.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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

    - #### getTargetHandler

          protected IFDocumentHandler getTargetHandler()

      Returns the target document handler.
      Returns:
        the target document handler

    - #### finish

          public void finish()
                      throws IFException

      Properly finishes the current output file by creating an empty document trailer and calling `IFDocumentHandler.endDocument()`.
      Throws:
        `IFException` - if an IF-related error occurs

    - #### appendDocument

          public void appendDocument(Source src)
                              throws 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:
        `TransformerException` - if an XML-related exception occurs during
        `IFException` - if an IF-related error occurs

Copyright © 2023 Apache Software Foundation. All rights reserved.