if (c1 == 'B' && c2 == 'M') {
return BmpImage.getImage(url);
}
if ((c1 == 'M' && c2 == 'M' && c3 == 0 && c4 == 42)
|| (c1 == 'I' && c2 == 'I' && c3 == 42 && c4 == 0)) {
RandomAccessFileOrArray ra = null;
try {
if (url.getProtocol().equals("file")) {
String file = url.getFile();
file = Utilities.unEscapeURL(file);
ra = new RandomAccessFileOrArray(file);
} else
ra = new RandomAccessFileOrArray(url);
LwgImage img = TiffImage.getTiffImage(ra, 1);
img.url = url;
return img;
} finally {
if (ra != null)
ra.close();
}
}
if ( c1 == 0x97 && c2 == 'J' && c3 == 'B' && c4 == '2' &&
c5 == '\r' && c6 == '\n' && c7 == 0x1a && c8 == '\n' ) {
RandomAccessFileOrArray ra = null;
try {
if (url.getProtocol().equals("file")) {
String file = url.getFile();
file = Utilities.unEscapeURL(file);
ra = new RandomAccessFileOrArray(file);
} else
ra = new RandomAccessFileOrArray(url);
LwgImage img = JBIG2Image.getJbig2Image(ra, 1);
img.url = url;
return img;
} finally {
if (ra != null)
ra.close();
}
}
throw new IOException(url.toString()
+ " is not a recognized imageformat.");
} finally {