Vfs

abstract class Vfs(val context: Context, val logger: Logger, var baseDir: String) : CoroutineScope

A virtual file system that handles loading and streaming data and files.

Author

Colton Daily

Constructors

Link copied to clipboard
fun Vfs(context: Context, logger: Logger, baseDir: String)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open fun close()

Cancels this vfs job.

Link copied to clipboard
operator fun get(path: String): VfsFile
Link copied to clipboard
open fun getAbsolutePath(path: String): String

Get the absolute path of the queried path based off the Vfs path.

Link copied to clipboard
fun launch(block: suspend Vfs.() -> Unit)

Launches a new coroutine using the this vfs coroutine context. Use this to load assets asynchronously.

Link copied to clipboard
abstract fun load(key: String): ByteBuffer?

Load an array of bytes from the storage directory based on the key.

Link copied to clipboard
abstract fun loadString(key: String): String?

Load a string from the storage directory based on the key.

Link copied to clipboard
suspend fun readBytes(assetPath: String): ByteBuffer

Loads a raw file into a ByteBuffer

Link copied to clipboard
suspend fun readStream(assetPath: String): ByteSequenceStream

Opens a stream to a file into a ByteSequenceStream.

Link copied to clipboard
abstract fun store(key: String, data: ByteArray): Boolean

Store array of bytes in the storage directory based on the key.

abstract fun store(key: String, data: String): Boolean

Store a string in the storage directory based on the key.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The root VfsFile that this Vfs starts from.

Inheritors

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Extensions

Link copied to clipboard
expect fun CoroutineScope.isOnRenderingThread(): Boolean

Returns true if the coroutine was launched from the rendering thread dispatcher.

actual fun CoroutineScope.isOnRenderingThread(): Boolean
actual fun CoroutineScope.isOnRenderingThread(): Boolean