update README
This commit is contained in:
38
README.md
38
README.md
@@ -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.
|
## Targets
|
||||||
* Binary
|
|
||||||
* Hex
|
| Target | Status |
|
||||||
* Base32
|
|------------------|---------------|
|
||||||
* Base64
|
| JVM | Supported |
|
||||||
* Multiplatform support
|
| JavaScript | Supported |
|
||||||
* JVM
|
| Native (Linux) | Supported |
|
||||||
* JavaScript
|
| Native (Windows) | Not Supported |
|
||||||
* Native (Linux)
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -24,21 +28,23 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("com.infendro:encoding:1.1.0")
|
implementation("com.infendro:encoding:1.2.0")
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```kotlin
|
```kotlin
|
||||||
import com.infendro.encoding.Hex
|
import com.infendro.encoding.Base16
|
||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
// the string to encode
|
// the string to encode
|
||||||
val test = "Hello World!".encodeToByteArray()
|
val test = "Hello World!"
|
||||||
|
.encodeToByteArray().asUByteArray()
|
||||||
|
|
||||||
// encode the string with the desired encoding
|
// encode the string with the desired encoding
|
||||||
val encoded = Hex.encode(test).decodeToString()
|
val encoded = Base16.encode(test)
|
||||||
|
.asByteArray().decodeToString()
|
||||||
|
|
||||||
println(encoded) // 48656c6c6f20576f726c6421
|
println(encoded) // 48656c6c6f20576f726c6421
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user