getUInt8

fun ByteArray.getUInt8(offset: Int): UByte

Reads a UInt8 value from the byte array at the specified offset.

This function reads a single byte (UInt8) from the byte array at the specified offset and interprets it as an unsigned 8-bit integer.

Return

The UInt8 value read from the byte array.

Parameters

offset

The offset (index) in the byte array from which the UInt8 value should be read. Must be within the valid range of the array's indices.

Throws

If the offset is negative or greater than or equal to the array's size.


fun ByteString.getUInt8(offset: Int): UByte

Gets an 8-bit unsigned integer (UInt8) from this ByteString at the specified offset.

This function retrieves a single byte from the ByteString at the given offset and returns it as an unsigned byte.

Return

The 8-bit unsigned integer value at the specified offset.

Parameters

offset

The index from which to read the UInt8 value.

Throws

if the offset is out of bounds or if the size of this ByteString is less than Byte.SIZE_BYTES.