1:
37:
38: package ;
39:
40: import ;
41: import ;
42: import ;
43: import ;
44: import ;
45:
46: public class BMPImageReaderSpi extends ImageReaderSpi {
47:
48: static final String vendorName = "GNU";
49: static final String version = "0.1";
50: static final String readerClassName =
51: "gnu.javax.imageio.bmp.BMPImageReader";
52: static final String[] names = { "Microsoft Windows BMP" };
53: static final String[] suffixes = { ".bmp", ".bm" };
54: static final String[] MIMETypes = {
55: "image/bmp",
56: "image/x-windows-bmp"};
57: static final String[] writerSpiNames =
58: { "gnu.javax.imageio.bmp.BMPImageWriterSpi" };
59:
60: static final boolean supportsStandardStreamMetadataFormat = false;
61: static final String nativeStreamMetadataFormatName = null;
62: static final String nativeStreamMetadataFormatClassName = null;
63: static final String[] extraStreamMetadataFormatNames = null;
64: static final String[] extraStreamMetadataFormatClassNames = null;
65: static final boolean supportsStandardImageMetadataFormat = false;
66: static final String nativeImageMetadataFormatName = null;
67: static final String nativeImageMetadataFormatClassName = null;
68: static final String[] extraImageMetadataFormatNames = null;
69: static final String[] extraImageMetadataFormatClassNames = null;
70:
71: public BMPImageReaderSpi() {
72: super(vendorName, version,
73: names, suffixes, MIMETypes,
74: readerClassName,
75: STANDARD_INPUT_TYPE,
76: writerSpiNames,
77: supportsStandardStreamMetadataFormat,
78: nativeStreamMetadataFormatName,
79: nativeStreamMetadataFormatClassName,
80: extraStreamMetadataFormatNames,
81: extraStreamMetadataFormatClassNames,
82: supportsStandardImageMetadataFormat,
83: nativeImageMetadataFormatName,
84: nativeImageMetadataFormatClassName,
85: extraImageMetadataFormatNames,
86: extraImageMetadataFormatClassNames);
87: }
88:
89: public String getDescription(Locale locale) {
90: return "Microsoft BMP v3";
91: }
92:
93: public boolean canDecodeInput(Object input)
94: throws IOException {
95: if (!(input instanceof ImageInputStream))
96: return false;
97:
98: ImageInputStream in = (ImageInputStream)input;
99: boolean retval;
100:
101: in.mark();
102: try {
103: new BMPFileHeader(in);
104: retval = true;
105: } catch(BMPException e){
106: retval = false;
107: }
108: in.reset();
109:
110: return retval;
111: }
112:
113: public ImageReader createReaderInstance(Object extension) {
114: return new BMPImageReader(this);
115: }
116: }