]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Buffer InputStream only when not already buffered.
authorJeremias Maerki <jeremias@apache.org>
Wed, 27 Jul 2005 13:58:42 +0000 (13:58 +0000)
committerJeremias Maerki <jeremias@apache.org>
Wed, 27 Jul 2005 13:58:42 +0000 (13:58 +0000)
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

index 1060144fd0f44ba319c8fc3d12704300f936dce6..ce287026d6673b198176ca04de891fc2ea1e73ce 100644 (file)
@@ -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);