diff options
author | Keiron Liddle <keiron@apache.org> | 2002-11-08 10:48:00 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2002-11-08 10:48:00 +0000 |
commit | 706230140ec1ac44971b9d74a71926a396c46360 (patch) | |
tree | e0a0465cae107bd67fe4fcd871977752992949e8 /src/org/apache/fop/image/analyser/BMPReader.java | |
parent | bb4d7f6ab1726f37d541bbb61a1a64169ba6058d (diff) | |
download | xmlgraphics-fop-706230140ec1ac44971b9d74a71926a396c46360.tar.gz xmlgraphics-fop-706230140ec1ac44971b9d74a71926a396c46360.zip |
handle image stream better, try to make sure only
opened once and properly closed
gif image broken until it can be loaded from a stream
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@195455 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache/fop/image/analyser/BMPReader.java')
-rw-r--r-- | src/org/apache/fop/image/analyser/BMPReader.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/org/apache/fop/image/analyser/BMPReader.java b/src/org/apache/fop/image/analyser/BMPReader.java index b15fd731c..7a1ea9afe 100644 --- a/src/org/apache/fop/image/analyser/BMPReader.java +++ b/src/org/apache/fop/image/analyser/BMPReader.java @@ -7,7 +7,7 @@ package org.apache.fop.image.analyser; // Java -import java.io.BufferedInputStream; +import java.io.InputStream; import java.io.IOException; // FOP @@ -26,13 +26,15 @@ public class BMPReader implements ImageReader { protected static final int BMP_SIG_LENGTH = 26; /** @see org.apache.fop.image.analyser.ImageReader */ - public FopImage.ImageInfo verifySignature(String uri, BufferedInputStream bis, + public FopImage.ImageInfo verifySignature(String uri, InputStream bis, FOUserAgent ua) throws IOException { byte[] header = getDefaultHeader(bis); boolean supported = ((header[0] == (byte) 0x42) && (header[1] == (byte) 0x4d)); if (supported) { - return getDimension(header); + FopImage.ImageInfo info = getDimension(header); + info.inputStream = bis; + return info; } else { return null; } @@ -69,7 +71,7 @@ public class BMPReader implements ImageReader { return info; } - private byte[] getDefaultHeader(BufferedInputStream imageStream) + private byte[] getDefaultHeader(InputStream imageStream) throws IOException { byte[] header = new byte[BMP_SIG_LENGTH]; try { @@ -87,4 +89,4 @@ public class BMPReader implements ImageReader { return header; } -}
\ No newline at end of file +} |