refs #35 bit granularity for bitstreams; LZW done

This commit is contained in:
sergeych committed 2025-07-13 00:37:27 +03:00
1 parent 23dafff453
commit 34bc7297bd
6 files changed
+117 -56

No files matched your search

@@ -5,10 +5,11 @@ package net.sergeych.lynon
*/
class LynonPacker(bout: MemoryBitOutput = MemoryBitOutput(), settings: LynonSettings = LynonSettings.default)
: LynonEncoder(bout, settings) {
fun toUByteArray(): UByteArray = (bout as MemoryBitOutput).toUByteArray()
}
/**
* Variant of [LynonDecoder] that reads from a given `source` using [MemoryBitInput]
*/
class LynonUnpacker(source: UByteArray) : LynonDecoder(MemoryBitInput(source))
class LynonUnpacker(source: BitInput) : LynonDecoder(source) {
constructor(packer: LynonPacker) : this(MemoryBitInput(packer.bout as MemoryBitOutput))
}