fromUByteArray

Creates a uuid from an array containing 128 bits split into 16 unsigned bytes.

Each unsigned byte in the ubyteArray sequentially represents the next 8 bits of the uuid, starting from the most significant 8 bits in the first byte to the least significant 8 bits in the last byte.

Since Kotlin

2.1

Return

A new uuid based on the specified bits.

Parameters

ubyteArray

A 16-byte array containing the uuid bits.

See also

Throws

If the size of the ubyteArray is not exactly 16.

Samples

import kotlin.test.*
import kotlin.uuid.*

fun main() { 
   //sampleStart 
   val ubyteArray = ubyteArrayOf(
    0x55u, 0x0Eu, 0x84u, 0x00u, 0xE2u, 0x9Bu, 0x41u, 0xD4u,
    0xA7u, 0x16u, 0x44u, 0x66u, 0x55u, 0x44u, 0x00u, 0x00u
)
val uuid = Uuid.fromUByteArray(ubyteArray)
println(uuid) // 550e8400-e29b-41d4-a716-446655440000 
   //sampleEnd
}