read

fun read(length: Int): ByteArray

Reads up to length bytes from the Large Object.

Return

A ByteArray containing the read data, or an empty array if EOF is reached.

Parameters

length

The maximum number of bytes to read.


fun read(buffer: ByteArray, offset: Int = 0, length: Int = buffer.size - offset): Int

Reads up to length bytes from the Large Object into the given buffer.

Return

The total number of bytes read into the buffer, or -1 if there is no more data because the end of the object has been reached.

Parameters

buffer

The byte array to store the read data.

offset

The starting offset in the buffer where data will be written. Defaults to 0.

length

The maximum number of bytes to read. Defaults to the remaining space in the buffer.