---
title: "StreamingDecoder"
sidebar_label: "StreamingDecoder"
description: "Kotlin binding reference: StreamingDecoder."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[StreamingDecoder](index.md)

# StreamingDecoder

[common]\
class [StreamingDecoder](index.md)

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](push.md) returns exactly the newly stable text (often empty while a code point is incomplete) and [finish](finish.md) 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](../Tokenizer/index.md) it came from is closed. `AutoCloseable`: [close](close.md) releases it.

## Functions

| Name | Summary |
|---|---|
| [close](close.md) | [common]<br>open fun [close](close.md)() |
| [finish](finish.md) | [common]<br>fun [finish](finish.md)(): [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)<br>Flush what is decoded but not yet emitted (a trailing incomplete sequence as is) and reset. |
| [push](push.md) | [common]<br>fun [push](push.md)(id: [Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)): [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)<br>Append one generated id; the newly stable text, possibly empty. |