implement composition
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user