There is an one-to-one correspondence between ULong
and Long
, so you can convert ULong
to Long
, put that into the buffer, and vice versa when reading. For convenience, declare these extension functions:
fun ByteBuffer.putULong(value: ULong): ByteBuffer = putLong(value.toLong())
fun ByteBuffer.getULong(): ULong = getLong().toULong()
and they can be called just like get
/put*()
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…