Skip to content

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.

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.

ReturnsSignatureSummary
booleansupports(byte[] header) abstractIf true, this format reads a file that starts with header, the first 4096 bytes of the file or fewer.
IResourceDecoderdecoder(Asset asset, byte[] header) abstractReturns the decoder that reads asset; JOID calls it only when supports returned true.

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. 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

Report a problem with this page