implement composition

This commit is contained in:
2026-01-19 19:55:39 +01:00
parent 684b6d78ea
commit c1b8800e82
26 changed files with 91 additions and 68 deletions

View File

@@ -1,15 +1,10 @@
package com.infendro.encoding
abstract class Encoding(
val alphabet: ByteArray,
) {
init {
require(alphabet.isNotEmpty())
}
interface Encoding {
val alphabet: ByteArray
val base: Int
get() = alphabet.size
abstract fun encode(bytes: ByteArray): ByteArray
abstract fun decode(bytes: ByteArray): ByteArray
fun encode(bytes: ByteArray): ByteArray
fun decode(bytes: ByteArray): ByteArray
}