ArrayReadBuffer

open class ArrayReadBuffer(buffer: ByteArray, offset: Int = 0, val limit: Int = buffer.size - offset) : ReadBuffer

Inheritors

Constructors

Link copied to clipboard
constructor(buffer: ByteArray, offset: Int = 0, limit: Int = buffer.size - offset)

Properties

Link copied to clipboard
open override val limit: Int

Defines the size of the message in the buffer. It also determines last position that buffer can be read. Last byte to be accessed is in position limit() -1.

Functions

Link copied to clipboard
open override fun data(): ByteArray

Expose ReadBuffer as an array of bytes. This method is meant to be as efficient as possible, so for an array-backed ReadBuffer, it should return its own internal data. In case access to internal data is not possible, a copy of the data into an array of bytes might occur.

Link copied to clipboard
open override fun findFirst(value: Byte, start: Int, end: Int): Int

Scan through the buffer for first byte matching value.

Link copied to clipboard
open operator override fun get(index: Int): Byte

Read a Byte from the buffer.

Link copied to clipboard
open override fun getBoolean(index: Int): Boolean

Read boolean from the buffer. Booleans as stored as a single byte

Link copied to clipboard
open override fun getBytes(array: ByteArray, start: Int, length: Int)

Read a ByteArray from the buffer.

Link copied to clipboard
open override fun getDouble(index: Int): Double

Read a 64-bit float from the buffer.

Link copied to clipboard
open override fun getFloat(index: Int): Float

Read a 32-bit float from the buffer.

Link copied to clipboard
open override fun getInt(index: Int): Int

Read a Int from the buffer.

Link copied to clipboard
open override fun getLong(index: Int): Long

Read a Long from the buffer.

Link copied to clipboard
open override fun getShort(index: Int): Short

Read a Short from the buffer.

Link copied to clipboard
open override fun getString(start: Int, size: Int): String

Read a UTF-8 string from the buffer.

Link copied to clipboard
open override fun getUByte(index: Int): UByte

Read a UByte from the buffer.

Link copied to clipboard
open override fun getUInt(index: Int): UInt

Read a UInt from the buffer.

Link copied to clipboard
open override fun getULong(index: Int): ULong

Read a ULong from the buffer.

Link copied to clipboard
open override fun getUShort(index: Int): UShort

Read a UShort from the buffer.

Link copied to clipboard
open override fun slice(start: Int, size: Int): ReadBuffer

Creates a new ReadBuffer point to a region of the current buffer, starting at start with size size.