intFrom
Convert 4
bytes from source ByteArray, starting at index offset, to an Int.
e.g.
val source = -77362181
val dest = ByteArray(4) { -100 }
println(dest.toList())
// [-100, -100, -100, -100]
Endian.Big.pack(source, dest, 0)
println(dest.toList())
// [-5, 99, -117, -5]
println(Endian.Big.intFrom(dest, 0))
// -77362181
dest.fill(-100)
Endian.Little.pack(source, dest, 0)
println(dest.toList())
// [-5, -117, 99, -5]
println(Endian.Little.intFrom(dest, 0))
// -77362181
Content copied to clipboard
Parameters
source
The ByteArray to access bytes from.
offset
The index to start at when retrieving bytes from source.
See also
Throws
IndexOutOfBoundsException
when not enough bytes are available in array from offset.