Skip to content

Latest commit

 

History

History
53 lines (42 loc) · 1.59 KB

readme.adoc

File metadata and controls

53 lines (42 loc) · 1.59 KB

Number Serialization

number serialization docs dokka ff69b4 number serialization

Pure Kotlin mixin/extension functions for converting numbers to raw bytes in the form of ByteArrays or UByteArrays.

Import

  implementation("io.k-libs:number-serialization:0.1.0")

Usage

Kotlin
// Get a ByteArray of the bytes that make up the target number value.
val bytes = 42.getBytes()

// Get a UByteArray of the bytes that make up the target number value.
val ubytes = 69.getUBytes()

// Write the bytes that make up a number into a given buffer.
val byteBuffer = ByteArray(4)
420.getBytes(buffer = byteBuffer, offset = 0)

// Write the ubytes that make up a number into a given buffer.
val ubyteBuffer = UByteArray(4)
666.getUBytes(buffer = ubyteBuffer)

Version History

Version Docs Description

v0.1.0

Dokka

Initial release. Contains conversion methods for signed and unsigned integral types.