1 7 8 package javax.imageio.spi; 9 10 import java.io.IOException ; 11 import javax.imageio.ImageReader ; 12 import javax.imageio.stream.ImageInputStream ; 13 14 57 public abstract class ImageReaderSpi extends ImageReaderWriterSpi { 58 59 64 public static final Class [] STANDARD_INPUT_TYPE = 65 { ImageInputStream .class }; 66 67 71 protected Class [] inputTypes = null; 72 73 78 protected String [] writerSpiNames = null; 79 80 84 private Class readerClass = null; 85 86 92 protected ImageReaderSpi() { 93 } 94 95 174 public ImageReaderSpi(String vendorName, 175 String version, 176 String [] names, 177 String [] suffixes, 178 String [] MIMETypes, 179 String readerClassName, 180 Class [] inputTypes, 181 String [] writerSpiNames, 182 boolean supportsStandardStreamMetadataFormat, 183 String nativeStreamMetadataFormatName, 184 String nativeStreamMetadataFormatClassName, 185 String [] extraStreamMetadataFormatNames, 186 String [] extraStreamMetadataFormatClassNames, 187 boolean supportsStandardImageMetadataFormat, 188 String nativeImageMetadataFormatName, 189 String nativeImageMetadataFormatClassName, 190 String [] extraImageMetadataFormatNames, 191 String [] extraImageMetadataFormatClassNames) { 192 super(vendorName, version, 193 names, suffixes, MIMETypes, readerClassName, 194 supportsStandardStreamMetadataFormat, 195 nativeStreamMetadataFormatName, 196 nativeStreamMetadataFormatClassName, 197 extraStreamMetadataFormatNames, 198 extraStreamMetadataFormatClassNames, 199 supportsStandardImageMetadataFormat, 200 nativeImageMetadataFormatName, 201 nativeImageMetadataFormatClassName, 202 extraImageMetadataFormatNames, 203 extraImageMetadataFormatClassNames); 204 205 if (inputTypes == null) { 206 throw new IllegalArgumentException 207 ("inputTypes == null!"); 208 } 209 if (inputTypes.length == 0) { 210 throw new IllegalArgumentException 211 ("inputTypes.length == 0!"); 212 } 213 this.inputTypes = (Class [])inputTypes.clone(); 214 if (writerSpiNames != null && writerSpiNames.length > 0) { 216 this.writerSpiNames = (String [])writerSpiNames.clone(); 217 } 218 } 219 220 233 public Class [] getInputTypes() { 234 return (Class [])inputTypes.clone(); 235 } 236 237 278 public abstract boolean canDecodeInput(Object source) throws IOException ; 279 280 295 public ImageReader createReaderInstance() throws IOException { 296 return createReaderInstance(null); 297 } 298 299 324 public abstract ImageReader createReaderInstance(Object extension) 325 throws IOException ; 326 327 344 public boolean isOwnReader(ImageReader reader) { 345 if (reader == null) { 346 throw new IllegalArgumentException ("reader == null!"); 347 } 348 String name = reader.getClass().getName(); 349 return name.equals(pluginClassName); 350 } 351 352 385 public String [] getImageWriterSpiNames() { 386 return writerSpiNames == null ? 387 null : (String [])writerSpiNames.clone(); 388 } 389 } 390 | Popular Tags |