getInt32

fun ByteArray.getInt32(offset: Int): Int

Reads an Int32 value from the byte array at the specified offset.

This function reads four bytes (Int32) from the byte array at the specified offset and interprets them as a signed 32-bit integer.

Return

The Int32 value read from the byte array.

Parameters

offset

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

Throws

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


fun ByteString.getInt32(offset: Int): Int

Gets a 32-bit signed integer (Int32) from this ByteString at the specified offset.

This function retrieves four bytes from the ByteString at the given offset and the next three bytes, and interprets them as a 32-bit signed integer in Big-Endian order.

Return

The 32-bit signed integer value at the specified offset.

Parameters

offset

The index from which to start reading the Int32 value.

Throws

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