]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Uses OutputStream
authorarved <arved@unknown>
Sat, 30 Dec 2000 04:44:36 +0000 (04:44 +0000)
committerarved <arved@unknown>
Sat, 30 Dec 2000 04:44:36 +0000 (04:44 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193935 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/apps/PDFOutputHandler.java
src/org/apache/fop/apps/XTCommandLine.java
src/org/apache/fop/apps/XTDriver.java

index 6d54b418ee863587b8759e1332d3263d7356aea7..aadba4b2f6675b4a6b01d8e6deb72b0e90b44683 100644 (file)
@@ -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);
   }
   
   //////////////////////////////////////////////////////////////////////////////////////
index 863f7836c6e7d049892ababed7ccc6c56f0d8d02..78e8b8658847c920600e5c3df1aae7c95b5cf17d 100644 (file)
@@ -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();
index 6b16c8ea8b9de9f590faae6541b65e4bedb7f755..b069bbabc4b3cdd20f216ad7f98e3ac237a9be5e 100644 (file)
@@ -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();
@@ -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);
     }
 }