added more tools, start shifting to kotlin 2.2.0

This commit is contained in:
sergeych committed 2025-09-25 10:29:47 +04:00
1 parent a121f2c4a6
commit 01d9e0239e
7 files changed
+132 -8

No files matched your search

@@ -1,7 +1,7 @@
package net.sergeych.bintools
import kotlinx.serialization.Serializable
import net.sergeych.mp_tools.encodeToBase64Compact
import net.sergeych.mp_tools.encodeToBase64Url
import kotlin.math.min
import kotlin.random.Random
@@ -53,7 +53,7 @@ class ByteChunk(val data: UByteArray): Comparable<ByteChunk> {
/**
* hex representation of data
*/
override fun toString(): String = hex
override fun toString(): String = base64
/**
* Hex encoded data
@@ -68,7 +68,7 @@ class ByteChunk(val data: UByteArray): Comparable<ByteChunk> {
/**
* Lazy encode to base64 with url alphabet, without trailing fill '=' characters.
*/
val base64 by lazy { data.asByteArray().encodeToBase64Compact() }
val base64 by lazy { data.asByteArray().encodeToBase64Url() }
/**
* Lazy (cached) view of [data] as ByteArray