Class AbstractWindowsTerminal<Console>

java.lang.Object
org.jline.terminal.impl.AbstractTerminal
org.jline.terminal.impl.AbstractWindowsTerminal<Console>
Type Parameters:
Console - the Windows console type used by the specific implementation
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, TerminalExt, Terminal
Direct Known Subclasses:
NativeWinSysTerminal

public abstract class AbstractWindowsTerminal<Console> extends AbstractTerminal
Base implementation for terminals on Windows systems.

The AbstractWindowsTerminal class provides a foundation for terminal implementations on Windows operating systems. It addresses Windows-specific limitations and peculiarities, particularly related to console handling, character encoding, and ANSI sequence support.

Due to Windows limitations, particularly the historically limited support for ANSI sequences, this implementation uses Windows-specific APIs to handle terminal operations such as setting character attributes, moving the cursor, erasing content, and other terminal functions. This approach provides better compatibility and performance compared to emulating ANSI sequences on Windows.

UTF-8 support has also been historically problematic on Windows, with the code page meant to emulate UTF-8 being somewhat broken. To work around these issues, this implementation uses the Windows API WriteConsoleW directly. As a result, the writer() method becomes the primary output mechanism, while the output() stream is bridged to the writer using a WriterOutputStream wrapper.

Key features provided by this class include:

  • Windows console API integration
  • Color attribute handling
  • Cursor positioning and manipulation
  • Proper UTF-8 and Unicode support
  • Input processing for Windows console events

This class is designed to be extended by concrete implementations that use specific Windows API access mechanisms (e.g., JNA, JNI, FFM).

See Also: