diff options
Diffstat (limited to 'src/org')
-rw-r--r-- | src/org/apache/fop/apps/PDFOutputHandler.java | 9 | ||||
-rw-r--r-- | src/org/apache/fop/apps/XTCommandLine.java | 3 | ||||
-rw-r--r-- | src/org/apache/fop/apps/XTDriver.java | 16 |
3 files changed, 21 insertions, 7 deletions
diff --git a/src/org/apache/fop/apps/PDFOutputHandler.java b/src/org/apache/fop/apps/PDFOutputHandler.java index 6d54b418e..aadba4b2f 100644 --- a/src/org/apache/fop/apps/PDFOutputHandler.java +++ b/src/org/apache/fop/apps/PDFOutputHandler.java @@ -33,6 +33,9 @@ public class PDFOutputHandler extends XTFOTreeBuilder implements OutputDocumentH /** the PrintWriter to use to output the results of the renderer */ protected PrintWriter writer; + /** the stream to use to output the results of the renderer */ + protected OutputStream stream; + private boolean keepOpen; ////////////////////////////////////////////////////////////////////////////////////// @@ -46,14 +49,14 @@ public class PDFOutputHandler extends XTFOTreeBuilder implements OutputDocumentH */ public PDFOutputHandler(OutputStream out) { this(); - this.writer = new PrintWriter(out); + this.stream = out; } ////////////////////////////////////////////////////////////////////////////////////// /** */ public DocumentHandler init(Destination dest, AttributeList atts) throws IOException { - this.writer = new PrintWriter(dest.getOutputStream("application/pdf", null)); + this.stream = dest.getOutputStream("application/pdf", null); this.keepOpen = dest.keepOpen(); String version = org.apache.fop.apps.Version.getVersion(); @@ -112,7 +115,7 @@ public class PDFOutputHandler extends XTFOTreeBuilder implements OutputDocumentH */ public void doRender() throws IOException,FOPException { - this.renderer.render(areaTree, this.writer); + this.renderer.render(areaTree, this.stream); } ////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/org/apache/fop/apps/XTCommandLine.java b/src/org/apache/fop/apps/XTCommandLine.java index 863f7836c..78e8b8658 100644 --- a/src/org/apache/fop/apps/XTCommandLine.java +++ b/src/org/apache/fop/apps/XTCommandLine.java @@ -116,7 +116,8 @@ public class XTCommandLine { driver.addElementMapping("org.apache.fop.svg.SVGElementMapping"); driver.addPropertyList("org.apache.fop.fo.StandardPropertyListMapping"); driver.addPropertyList("org.apache.fop.svg.SVGPropertyListMapping"); - driver.setOutputStream(new FileOutputStream(args[2])); + OutputStream stream = new BufferedOutputStream(new FileOutputStream(args[2])); + driver.setOutputStream(stream); driver.buildFOTree(xslProcessor, fileInputSource(args[0])); driver.format(); driver.render(); diff --git a/src/org/apache/fop/apps/XTDriver.java b/src/org/apache/fop/apps/XTDriver.java index 6b16c8ea8..b069bbabc 100644 --- a/src/org/apache/fop/apps/XTDriver.java +++ b/src/org/apache/fop/apps/XTDriver.java @@ -74,8 +74,7 @@ import org.xml.sax.SAXException; import org.xml.sax.helpers.AttributesImpl; // Java -import java.io.PrintWriter; -import java.io.IOException; +import java.io.*; /** * <P>Primary class that drives overall FOP process. @@ -127,6 +126,9 @@ public class XTDriver { /** the PrintWriter to use to output the results of the renderer */ protected PrintWriter writer; + /** the stream to use to output the results of the renderer */ + protected OutputStream stream; + /** create a new Driver */ public XTDriver() { this.treeBuilder = new XTFOTreeBuilder(); @@ -367,6 +369,14 @@ public class XTDriver { } /** + * set the OutputStream to use to output the result of the Renderer + * (if applicable) + */ + public void setOutputStream(OutputStream stream) { + this.stream = stream; + } + + /** * format the formatting object tree into an area tree */ public void format() @@ -385,6 +395,6 @@ public class XTDriver { */ public void render() throws IOException, FOPException { - this.renderer.render(areaTree, this.writer); + this.renderer.render(areaTree, this.stream); } } |