Skip to main content

//clika-runtime/io.clika.runtime/StreamingDecoder

StreamingDecoder

[common]
class StreamingDecoder

Incremental id-to-text decoding for a generation stream. Ids arrive one at a time, but decoded bytes are displayable only at UTF-8 boundaries (a code point can span tokens): push returns exactly the newly stable text (often empty while a code point is incomplete) and finish flushes the tail and resets the decoder for a fresh stream. One decoder serves one stream at a time; it stays valid after the Tokenizer it came from is closed. AutoCloseable: close releases it.

Functions​

NameSummary
close[common]
open fun close()
finish[common]
fun finish(): String
Flush what is decoded but not yet emitted (a trailing incomplete sequence as is) and reset.
push[common]
fun push(id: Int): String
Append one generated id; the newly stable text, possibly empty.