From e107517749f5ee072f58545da3634d5378320465 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Wed, 27 Jul 2005 13:58:42 +0000 Subject: [PATCH] Buffer InputStream only when not already buffered. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@225510 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/image/ImageFactory.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/fop/image/ImageFactory.java b/src/java/org/apache/fop/image/ImageFactory.java index 1060144fd..ce287026d 100644 --- a/src/java/org/apache/fop/image/ImageFactory.java +++ b/src/java/org/apache/fop/image/ImageFactory.java @@ -281,8 +281,12 @@ public class ImageFactory { return null; } - //Decorate the InputStream with a BufferedInputStream - return new java.io.BufferedInputStream(in); + //Make sure the InputStream is decorated with a BufferedInputStream + if (in instanceof java.io.BufferedInputStream) { + return in; + } else { + return new java.io.BufferedInputStream(in); + } } catch (Exception e) { log.error("Error while opening stream for (" + href + "): " + e.getMessage(), e); -- 2.39.5