Blob

Streams the content of a single BLOB value in and out without loading it fully into memory, see the BLOB API.

Unless documented otherwise, every member throws IllegalStateException once this blob is closed.

Properties

Link copied to clipboard
abstract val bytes: Int

Size of this blob in bytes. This does not change over the life of this instance, reopen this blob with reopen to observe a value written concurrently by another connection.

Functions

Link copied to clipboard
abstract override fun close()

Closes this blob, releasing the resources it holds. Calling this again on an already closed blob has no effect.

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

Reads size bytes from this blob, starting at offset, into output.

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

Reads size bytes from this blob, starting at offset, and returns them as a new ByteArray.

Link copied to clipboard
abstract fun reopen(rowid: Long)

Points this blob at the row identified by rowid, in the same database, table and column it was originally opened on. This is cheaper than closing and reopening a new Blob.

Link copied to clipboard
abstract fun write(input: ByteArray, size: Int = input.size, offset: Int = 0)

Writes size bytes from input into this blob, starting at offset.