Buffer

Region of native memory that can be read and written.

Buffer does not provide any kind of thread-safety and external synchronization is required if concurrent access is needed.

Attempting to alter the buffer while it is in use by SQLite will throw an IllegalStateException.

The Buffer must be closed once no longer needed to release allocated resources.

Types

Link copied to clipboard
object Companion

Provides factory functions for allocating a Buffer.

Properties

Link copied to clipboard

Size of the memory region in bytes.

Functions

Link copied to clipboard
open override fun close()

Releases allocated resources.

Link copied to clipboard
fun read(destination: ByteArray, size: Int = destination.size, sourceOffset: Long = 0, destinationOffset: Int = 0)

Reads size bytes from the native memory block into destination.

Link copied to clipboard
fun ReadableBuffer.read(size: Int, offset: Long = 0): ByteArray

Reads size bytes from the native memory block and returns a ByteArray holding them.

Link copied to clipboard

Reads at most Int.MAX_VALUE bytes from this buffer.

Link copied to clipboard

Reads all bytes from this buffer.

Link copied to clipboard
fun resize(newSize: Int)
fun resize(newSize: Long)

Resizes this buffer to newSize. If allocation fails, this buffer stays untouched.

Link copied to clipboard
fun write(source: ByteArray, size: Int, sourceOffset: Int = 0, destinationOffset: Long = 0)

Writes size bytes from source into the native memory block.