Class AnsiWriter

java.lang.Object
java.io.Writer
java.io.FilterWriter
org.jline.utils.AnsiWriter
All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable
Direct Known Subclasses:
WindowsAnsiWriter

public class AnsiWriter extends FilterWriter
A writer that processes ANSI escape sequences.

The AnsiWriter class extends FilterWriter to intercept and process ANSI escape sequences written to the underlying writer. It extracts ANSI escape codes and calls corresponding process* methods for each recognized sequence.

This class just filters out the escape codes so that they are not sent out to the underlying Writer: process* methods are empty. Subclasses should actually perform the ANSI escape behaviors by implementing active code in process* methods.

This class is useful for implementing terminal emulation, where ANSI escape sequences need to be interpreted to control cursor movement, text attributes, colors, and other terminal features.

The class handles various ANSI escape sequences, including:

  • Cursor movement (up, down, left, right)
  • Cursor positioning (absolute and relative)
  • Text attributes (bold, underline, blink, etc.)
  • Colors (foreground and background)
  • Screen clearing and line manipulation

For more information about ANSI escape codes, see: Wikipedia: ANSI escape code

Since:
1.0