
Lightweight utilities simplifying data manipulation: bit checks, binary and hex formatting, structured byte-array reads with endianness control, and direct numeric-array conversions.
DataUtils is a lightweight Kotlin Multiplatform library designed to simplify common data manipulation tasks. It provides a set of extension functions for basic types, making it easier to work with bits, hex strings, and structured byte arrays.
Byte, Short, Int, or Long.ByteArray directly to FloatArray, IntArray, or LongArray.| Feature | Byte |
Short |
Int |
Long |
ByteArray |
|---|---|---|---|---|---|
isBitSet(position) |
✅ | ✅ | ✅ | ✅ | - |
toBinary(bits) |
✅ | ✅ | ✅ | ✅ | - |
toHex(bytes?) |
✅ | ✅ | ✅ | ✅ | ✅ |
readShort(start, endian) |
- | - | - | - | ✅ |
readUShort(start, endian) |
- | - | - | - | ✅ |
readInt(start, endian) |
- | - | - | - | ✅ |
readString(start, bytes) |
- | - | - | - | ✅ |
toFloatArray() |
- | - | - | - | ✅ |
toIntArray() |
- | - | - | - | ✅ |
toLongArray() |
- | - | - | - | ✅ |
./gradlew publishDataUtils is a lightweight Kotlin Multiplatform library designed to simplify common data manipulation tasks. It provides a set of extension functions for basic types, making it easier to work with bits, hex strings, and structured byte arrays.
Byte, Short, Int, or Long.ByteArray directly to FloatArray, IntArray, or LongArray.| Feature | Byte |
Short |
Int |
Long |
ByteArray |
|---|---|---|---|---|---|
isBitSet(position) |
✅ | ✅ | ✅ | ✅ | - |
toBinary(bits) |
✅ | ✅ | ✅ | ✅ | - |
toHex(bytes?) |
✅ | ✅ | ✅ | ✅ | ✅ |
readShort(start, endian) |
- | - | - | - | ✅ |
readUShort(start, endian) |
- | - | - | - | ✅ |
readInt(start, endian) |
- | - | - | - | ✅ |
readString(start, bytes) |
- | - | - | - | ✅ |
toFloatArray() |
- | - | - | - | ✅ |
toIntArray() |
- | - | - | - | ✅ |
toLongArray() |
- | - | - | - | ✅ |
./gradlew publish