update README

This commit is contained in:
2025-12-13 20:44:03 +01:00
parent 21858641e5
commit 688beb61b9

View File

@@ -1,18 +1,22 @@
# Kotlin Encoding
# encoding-kt
This library provides various character encodings in Kotlin Multiplatform.
`encoding-kt` is a Kotlin Multiplatform library that provides common `ByteArray` encodings.
## Features
Supported encodings:
- Base2 (binary)
- Base8 (octal)
- Base16 (hexadecimal)
- Base32
- Base64
* Encode and decode ByteArrays using various character encodings.
* Binary
* Hex
* Base32
* Base64
* Multiplatform support
* JVM
* JavaScript
* Native (Linux)
## Targets
| Target | Status |
|------------------|---------------|
| JVM | Supported |
| JavaScript | Supported |
| Native (Linux) | Supported |
| Native (Windows) | Not Supported |
## Installation
@@ -24,21 +28,23 @@ repositories {
}
dependencies {
implementation("com.infendro:encoding:1.1.0")
implementation("com.infendro:encoding:1.2.0")
}
```
## Usage
```kotlin
import com.infendro.encoding.Hex
import com.infendro.encoding.Base16
fun main() {
// the string to encode
val test = "Hello World!".encodeToByteArray()
val test = "Hello World!"
.encodeToByteArray().asUByteArray()
// encode the string with the desired encoding
val encoded = Hex.encode(test).decodeToString()
val encoded = Base16.encode(test)
.asByteArray().decodeToString()
println(encoded) // 48656c6c6f20576f726c6421
}