An abstract class allowing the creation of image decoders and encoders. Instances of
ImageCodec
may be registered. Once a codec has been registered, the format name associated with it may be used as the
name
parameter in the
createImageEncoder()
and
createImageDecoder()
methods.
Additionally, subclasses of ImageCodec
are able to perform recognition of their particular format, wither by inspection of a fixed-length file header or by arbitrary access to the source data stream.
Format recognition is performed by two variants of the isFormatRecognized()
method. Which variant should be called is determined by the output of the codec's getNumHeaderBytes() method, which returns 0 if arbitrary access to the stream is required, and otherwise returns the number of header bytes required to recognize the format. Each subclass of ImageCodec
needs to implement only one of the two variants. This class is not a committed part of the JAI API. It may be removed or changed in future releases of JAI.