Skip to main content

com.bluebillywig.bbnativeshared.interfaces — Functions

cachedFile​

fun cachedFile(key: String) : FontFileEntry? /** Full contents of the file cached under [key], or null when there is none. */ fun cachedContents(key: String): ByteArray? /** Write [contents] under [key], replacing what was there. Returns null when it failed. */ fun put(key: String, contents: ByteArray) : FontFileEntry?

Metadata + first bytes of the file cached under [key], or null when there is none.

cachedContents​

fun cachedContents(key: String) : ByteArray? /** Write [contents] under [key], replacing what was there. Returns null when it failed. */ fun put(key: String, contents: ByteArray) : FontFileEntry?

Full contents of the file cached under [key], or null when there is none.

put​

fun put(key: String, contents: ByteArray) : FontFileEntry?

Write [contents] under [key], replacing what was there. Returns null when it failed.

download​

fun download( key: String, url: String, onSuccess: (entry: FontFileEntry) -> Unit, onFailure: (error: String) -> Unit ) : Unit /** Drop the entry for [key]. Called when its bytes failed validation. */ fun remove(key: String): Unit fun __destruct() : Unit

Download [url] into the cache under [key], replacing what was there.

There is no cancel handle by design: once a key has been handed over, the transfer runs to its end and fills the cache for the next launch. The shared module stops waiting long before that, so the callback may well land after its resolver's __destruct - a store that touches its owner from the callback must survive that, and the shared module simply drops the bytes it has nobody left to hand them to.

remove​

fun remove(key: String) : Unit fun __destruct() : Unit

Drop the entry for [key]. Called when its bytes failed validation.