getUInt16

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

This function reads two bytes (UInt16) from the byte array at the specified offset and interprets them as an unsigned 16-bit integer.

Return

The UInt16 value read from the byte array.

Parameters

offset

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

Throws

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


fun ByteString.getUInt16(offset: Int): UShort

Gets a 16-bit unsigned integer (UInt16) from this ByteString at the specified offset.

This function retrieves two bytes from the ByteString at the given offset and the next byte, and interprets them as a 16-bit unsigned integer in Big-Endian order.

Return

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

Parameters

offset

The index from which to start reading the UInt16 value.

Throws

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