Returns
true
if the supplied source object appears to be of the format supported by this reader. Returning
true
from this method does not guarantee that reading will succeed, only that there appears to be a reasonable chance of success based on a brief inspection of the stream contents. If the source is an
ImageInputStream
, implementations will commonly check the first several bytes of the stream for a "magic number" associated with the format. Once actual reading has commenced, the reader may still indicate failure at any time prior to the completion of decoding.
It is important that the state of the object not be disturbed in order that other ImageReaderSpi
s can properly determine whether they are able to decode the object. In particular, if the source is an ImageInputStream
, a mark
/reset
pair should be used to preserve the stream position.
Formats such as "raw," which can potentially attempt to read nearly any stream, should return false
in order to avoid being invoked in preference to a closer match.
If source
is not an instance of one of the classes returned by getInputTypes
, the method should simply return false
.
@param source the object (typically anImageInputStream
) to be decoded.
@return true
if it is likely that this stream canbe decoded.
@exception IllegalArgumentException if source
isnull
.
@exception IOException if an I/O error occurs while reading thestream.