ccs.cpc
Interface CpcImageDecoder

All Known Implementing Classes:
SunJpegCodec, ToolkitDecoder

public interface CpcImageDecoder

CpcImageDecoder instances decode images synchronously and return the result. Operations are synchronised externally so the code need not be MT-Safe. More explicitly, a given instance will not be asked to decode more than one image at once (so it's safe to keep state inside the object itself, you don't need to spawn separate worker or state objects) but will be asked to decode multiple images over the object's lifecycle. Implementing objects are required to have a sane default constructor; this will be used to instantiate them.


Method Summary
 CpcImage decode(java.lang.String mimeType, byte[] wad)
          Decode the supplied image data synchronously, returning an image which is ready to use.
 java.lang.String getDescription()
          Return a user-friendly one-line description of this decoder.
 java.lang.String[] getSupportedTypes()
          Return the list of MIME types which this decoder can handle.
 

Method Detail

getSupportedTypes

java.lang.String[] getSupportedTypes()
Return the list of MIME types which this decoder can handle.


getDescription

java.lang.String getDescription()
Return a user-friendly one-line description of this decoder. This can be in the form of a Checkpoint I18N key; the result will be fed to ccs.utils.MsgHelper before being displayed.


decode

CpcImage decode(java.lang.String mimeType,
                byte[] wad)
Decode the supplied image data synchronously, returning an image which is ready to use. If acceptsStream returns true, this will not be called.

Parameters:
mimeType - The apparent MIME type of the image data. You may be able to tell different (eg. by reading magic from the start of the data).
wad - The input data.
Returns:
The decoded image, if decodable. If you can't decode the image (wrong format, corrupt data, unsupported subformat / options etc.) return null.