Class IFConcatenator
- java.lang.Object
-
- org.apache.fop.render.intermediate.util.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
IFConcatenator.IFPageSequenceFilter
-
Field Summary
Fields Modifier and Type Field Description private boolean
inFirstDocument
private int
nextPageIndex
private IFDocumentHandler
targetHandler
-
Constructor Summary
Constructors Constructor 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 Description void
appendDocument(javax.xml.transform.Source src)
Appends another intermediate format document to the current output file.private void
endDocument()
void
finish()
Properly finishes the current output file by creating an empty document trailer and callingIFDocumentHandler.endDocument()
.protected IFDocumentHandler
getTargetHandler()
Returns the target document handler.private void
startDocument(org.apache.xmlgraphics.xmp.Metadata metadata)
-
-
-
Field Detail
-
targetHandler
private IFDocumentHandler targetHandler
-
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 handlermetadata
- 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
-
endDocument
private void endDocument() throws IFException
- Throws:
IFException
-
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 callingIFDocumentHandler.endDocument()
.- Throws:
IFException
- if an IF-related error occurs
-
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 afterfinish()
has been called.- Parameters:
src
- the JAXP Source identifying the input document- Throws:
javax.xml.transform.TransformerException
- if an XML-related exception occurs duringIFException
- if an IF-related error occurs
-
-