diff options
author | Jeremias Maerki <jeremias@apache.org> | 2007-11-20 07:14:33 +0000 |
---|---|---|
committer | Jeremias Maerki <jeremias@apache.org> | 2007-11-20 07:14:33 +0000 |
commit | adaeaeae7dd5ca1e5e3de8b5d88e496d5e733c93 (patch) | |
tree | b909c43385458425ca21eef27c4eb84756d86e52 /src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java | |
parent | fcedea93410031b5a7704e3309dce0a19c4b3de8 (diff) | |
download | xmlgraphics-fop-adaeaeae7dd5ca1e5e3de8b5d88e496d5e733c93.tar.gz xmlgraphics-fop-adaeaeae7dd5ca1e5e3de8b5d88e496d5e733c93.zip |
Bugzilla #43904:
Buffer the OutputStreams in our transcoders if the users forget.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@596554 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java')
-rw-r--r-- | src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java b/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java index e228b16bc..e6a855b83 100644 --- a/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java +++ b/src/java/org/apache/fop/render/ps/AbstractPSTranscoder.java @@ -21,7 +21,12 @@ package org.apache.fop.render.ps; import java.awt.Color; +import java.io.BufferedOutputStream; import java.io.IOException; +import java.io.OutputStream; + +import org.w3c.dom.Document; +import org.w3c.dom.svg.SVGLength; import org.apache.avalon.framework.configuration.Configuration; import org.apache.batik.bridge.BridgeContext; @@ -29,13 +34,12 @@ import org.apache.batik.bridge.UnitProcessor; import org.apache.batik.transcoder.TranscoderException; import org.apache.batik.transcoder.TranscoderOutput; import org.apache.batik.transcoder.image.ImageTranscoder; +import org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D; +import org.apache.xmlgraphics.java2d.ps.TextHandler; + import org.apache.fop.fonts.FontInfo; import org.apache.fop.fonts.FontSetup; import org.apache.fop.svg.AbstractFOPTranscoder; -import org.apache.xmlgraphics.java2d.ps.AbstractPSDocumentGraphics2D; -import org.apache.xmlgraphics.java2d.ps.TextHandler; -import org.w3c.dom.Document; -import org.w3c.dom.svg.SVGLength; /** * This class enables to transcode an input to a PostScript document. @@ -114,7 +118,11 @@ public abstract class AbstractPSTranscoder extends AbstractFOPTranscoder { getLogger().trace("document size: " + w + "pt x " + h + "pt"); try { - graphics.setupDocument(output.getOutputStream(), w, h); + OutputStream out = output.getOutputStream(); + if (!(out instanceof BufferedOutputStream)) { + out = new BufferedOutputStream(out); + } + graphics.setupDocument(out, w, h); graphics.setViewportDimension(width, height); if (hints.containsKey(ImageTranscoder.KEY_BACKGROUND_COLOR)) { |