ByteArrayAccessor

class ByteArrayAccessor(data: ByteArray, offset: Int = 0, val sizeInBytes: Long = (data.size - offset).toLong()) : BufferAccessor(source)

BufferAccessor over a plain ByteArray.

Constructors

Link copied to clipboard
constructor(data: ByteArray, offset: Int = 0, sizeInBytes: Long = (data.size - offset).toLong())

Properties

Link copied to clipboard
open override val sizeInBytes: Long

Total accessible bytes.

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open override fun readAllBytes(): ByteArray

Read all bytes into a new array. Only practical for small buffers.

Link copied to clipboard
open override fun readByte(offset: Long): Byte

Read a single byte at offset.

Link copied to clipboard
open override fun readBytes(offset: Long, length: Int): ByteArray

Read length bytes starting at offset.

Link copied to clipboard
fun sliced(byteOffset: Long, size: Long): ByteArrayAccessor

Create a sub-accessor without copying.