JvmRandomAccessSource

JVM implementation of RandomAccessSource using FileChannel.

Provides efficient random access to files without loading the entire content into memory. Thread-safe for concurrent reads.

Usage:

JvmRandomAccessSource.open("/path/to/model.gguf").use { source ->
val header = source.readAt(0, 24)
println("File size: ${source.size}")
}

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val size: Long

The total size of the source in bytes.

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun readAt(position: Long, length: Int): ByteArray

Read bytes from the specified position.

open override fun readAt(position: Long, buffer: ByteArray, offset: Int, length: Int): Int

Read bytes into an existing buffer.