create

abstract fun create(result: SourceFetchResult, options: Options, imageLoader: ImageLoader): Decoder?

Return a Decoder that can decode result or 'null' if this factory cannot create a decoder for the source.

Implementations must not consume result's ImageSource, as this can cause calls to subsequent decoders to fail. ImageSources should only be consumed in decode.

Prefer using BufferedSource.peek, BufferedSource.rangeEquals, or other non-consuming methods to check for the presence of header bytes or other markers. Implementations can also rely on SourceFetchResult.mimeType, however it is not guaranteed to be accurate (e.g. a file that ends with .png, but is encoded as a .jpg).

Parameters

result

The result from the Fetcher.

options

A set of configuration options for this request.

imageLoader

The ImageLoader that's executing this request.