IResourceFormat
interface IResourceFormat
Known subtypes: ApngResourceFormat, GifResourceFormat, HeifResourceFormat, SvgResourceFormat, VideoResourceFormat, WebpResourceFormat
Package: dev.joid.lib.resource.format · Module: core · Source: IResourceFormat.java
Recognizes one file format from its first bytes and creates the decoder that reads it.
Description
Section titled “Description”Register it with ResourceFormat.register so that Resource.of reads your format.
JOID calls both methods on the thread that detects the format, often a background thread.
Learn more
Section titled “Learn more”Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
boolean | supports(byte[] header) abstract | If true, this format reads a file that starts with header, the first 4096 bytes of the file or fewer. |
IResourceDecoder | decoder(Asset asset, byte[] header) abstract | Returns the decoder that reads asset; JOID calls it only when supports returned true. |
Method details
Section titled “Method details”supports
Section titled “supports”boolean supports(byte[] header) abstract
If true, this format reads a file that starts with header, the first 4096 bytes of the file or fewer.
decoder
Section titled “decoder”IResourceDecoder decoder(Asset asset, byte[] header) abstract
Returns the decoder that reads asset; JOID calls it only when supports returned true.
Throw an exception to make the resource fail with its message.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
