create
Creates a new instance of TerminalOutputParser that routes parsed commands to the specified sink.
Retains the first 32 codepoints of each grapheme, including its base. Excess continuations advance segmentation context but are not emitted, so they do not create cells or contribute to stored, rendered, or copied text.
Return
A newly initialized TerminalOutputParser instance.
Parameters
The command sink where parsed terminal commands will be delivered.
Supplies the permitted decoded-byte budget when OSC 52 write data starts. Zero keeps the ordinary 4 KiB envelope bound. A positive budget permits bounded, temporary Base64 collection beyond that bound; it does not authorize a clipboard operation. The sink must validate the complete data and current permission. The callback runs synchronously at most once per write and must return a nonnegative value. Command/selection headers remain bounded by 4 KiB. Encoded capacity is computed with checked-width arithmetic and capped at Int.MAX_VALUE - 8 for JVM array indexing. Budget changes affect the next write; a completed command still needs current host validation.
Creates a parser with a host-owned handler for unsupported OSC commands.
The sink and clipboard budget have the same contracts as the two-argument overload. Use a session's parser factory to retain its assembled sink and live clipboard budget. customOscHandler defines payload ownership, bounds, ordering, and failure behavior.
Creates a parser with a fixed host limit for unsupported OSC commands.
customOscPayloadLimitBytes counts collected bytes, including decimal digits and the first semicolon. Introducers, terminators, and ignored controls do not count. The default overload uses 4096 bytes. The command header, including its semicolon, always has a separate 4096-byte ceiling. Built-in OSC and DCS limits remain unchanged, including the independent clipboard budget.
Storage grows on demand after a valid custom header. The parser releases growth when the command ends or overflows. Cancellation, reset, EOF, and callback failure also release growth. Host copies and decoding require separate storage. customOscHandler defines the remaining ownership, ordering, and failure contracts.
Throws
if customOscPayloadLimitBytes is outside 1..Int.MAX_VALUE - 8.