Class LineDisciplineTerminal

java.lang.Object
org.jline.terminal.impl.AbstractTerminal
org.jline.terminal.impl.LineDisciplineTerminal
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, TerminalExt, Terminal
Direct Known Subclasses:
ExternalTerminal

public class LineDisciplineTerminal extends AbstractTerminal
Abstract terminal with support for line discipline. The Terminal interface represents the slave side of a PTY, but implementations derived from this class will handle both the slave and master side of things. In order to correctly handle line discipline, the terminal needs to read the input in advance in order to raise the signals as fast as possible. For example, when the user hits Ctrl+C, we can't wait until the application consumes all the read events. The same applies to echoing, when enabled, as the echoing has to happen as soon as the user hit the keyboard, and not only when the application running in the terminal processes the input.

The LineDisciplineTerminal class provides a terminal implementation that emulates the line discipline functionality typically provided by the operating system's terminal driver. Line discipline refers to the processing of input and output characters according to various modes and settings, such as canonical mode, echo, and special character handling.

This terminal implementation is particularly useful in environments where:

  • The underlying system does not provide native terminal capabilities
  • The application needs precise control over terminal behavior
  • The terminal is being used in a non-standard environment (e.g., embedded systems)

Key features of this implementation include:

  • Emulation of canonical and non-canonical input modes
  • Support for character echoing
  • Special character handling (e.g., interrupt, erase, kill)
  • Input and output processing according to terminal attributes

This terminal implementation works with any input and output streams, making it highly flexible and adaptable to various environments.

See Also: