KetraTerm
API · DevelopmentAll versions

TerminalOutputParser

Byte-stream parser contract for terminal host output.

Implementations accept raw bytes from PTY/network/process output, preserve parser state across arbitrary chunk boundaries, and emit semantic terminal operations to a TerminalCommandSink.

Factory-created parsers require serialized, non-reentrant calls, including reset and end-of-input. Sink and custom OSC callbacks run synchronously on the calling thread. Supplied byte ranges are consumed before returning and may then be reused. Callback exceptions propagate to the caller; stop processing that stream after a failed callback rather than assuming parser and sink state remain aligned.

Inheritors

Functions

Link copied to clipboard
abstract fun accept(bytes: ByteArray, offset: Int = 0, length: Int = bytes.size - offset)

Feeds a chunk of bytes from the terminal host output stream to the parser.

Link copied to clipboard
abstract fun acceptByte(byteValue: Int)

Feeds a single byte from the terminal host output stream to the parser.

Link copied to clipboard
abstract fun endOfInput()

Signals the end of the input stream.

Link copied to clipboard
abstract fun reset()

Resets the internal parser state, discarding any partially parsed sequences or control signatures.