public boolean filter(Object elt) {
try {
ImageReaderSpi spi = (ImageReaderSpi)elt;
ImageInputStream stream = null;
if (input instanceof ImageInputStream) {
stream = (ImageInputStream)input;
}
// Perform mark/reset as a defensive measure
// even though plug-ins are supposed to take
// care of it.
boolean canDecode = false;
if (stream != null) {
stream.mark();
}
canDecode = spi.canDecodeInput(input);
if (stream != null) {
stream.reset();
}
return canDecode;
} catch (IOException e) {
return false;
}
}
|