From: arved Date: Sat, 30 Dec 2000 04:44:36 +0000 (+0000) Subject: Uses OutputStream X-Git-Tag: fop-0_17_0~126 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9ed37831a47383dce8d8f8ddf8436f2b916b5d25;p=xmlgraphics-fop.git Uses OutputStream git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193935 13f79535-47bb-0310-9956-ffa450edef68 --- 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.*; /** *

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(); @@ -366,6 +368,14 @@ public class XTDriver { this.writer = writer; } + /** + * 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 */ @@ -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); } }