DirectSeekableSource

A JVM and Android extension of SeekableSource that transfers bytes directly into a NIO ByteBuffer, bypassing intermediate JVM heap ByteArray copies across the JNI boundary.

When a DirectSeekableSource is passed to KioArch.createReader, the native JNI layer allocates a direct ByteBuffer via NewDirectByteBuffer and invokes read directly into native memory.

See also

Inheritors

ParcelFileDescriptorSeekableSource

Functions

Link copied to clipboard
abstract fun length(): Long

Returns the total size of the underlying data source in bytes.

Link copied to clipboard
abstract fun position(): Long

Returns the current zero-based read offset in bytes from the beginning of the stream.

Link copied to clipboard
abstract fun read(byteBuffer: ByteBuffer): Int

Reads a sequence of bytes from this source at the current position into byteBuffer.

abstract fun read(buffer: ByteArray, offset: Int, length: Int): Int

Reads up to length bytes from the current position into buffer starting at offset.

Link copied to clipboard
abstract fun seek(position: Long)

Sets the absolute byte offset from the beginning of the stream for the next read operation.