diff options
author | arved <arved@unknown> | 2000-12-30 04:44:36 +0000 |
---|---|---|
committer | arved <arved@unknown> | 2000-12-30 04:44:36 +0000 |
commit | 9ed37831a47383dce8d8f8ddf8436f2b916b5d25 (patch) | |
tree | 9bac8005daae425c9bc11f6013b2681fb45248fe /src | |
parent | 4ccbe9c36dc4b3b0f2a2c8a9b14c3449f78a9a11 (diff) | |
download | xmlgraphics-fop-9ed37831a47383dce8d8f8ddf8436f2b916b5d25.tar.gz xmlgraphics-fop-9ed37831a47383dce8d8f8ddf8436f2b916b5d25.zip |
Uses OutputStream
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193935 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-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); } } |