Class ScreenTerminal

java.lang.Object
org.jline.builtins.ScreenTerminal

public class ScreenTerminal extends Object
A virtual terminal screen implementation.

This class provides a virtual terminal screen that can process ANSI escape sequences and maintain the state of a terminal display. It supports features including:

  • Cursor positioning and movement
  • Text attributes (bold, underline, etc.)
  • Color support (including 256 colors)
  • Screen clearing and scrolling
  • Alternate screen buffer
  • Screen resizing

This implementation is based on the Apache Karaf WebConsole Gogo plugin, with adaptations to support alternate screen, resizing, and 256 colors. It follows the ECMA-48 standard for terminal control sequences.

  • Constructor Details

    • ScreenTerminal

      public ScreenTerminal()
    • ScreenTerminal

      public ScreenTerminal(int width, int height)
  • Method Details

    • isDirty

      public boolean isDirty()
    • waitDirty

      public void waitDirty() throws InterruptedException
      Throws:
      InterruptedException
    • waitDirty

      public boolean waitDirty(long timeout) throws InterruptedException
      Waits for the screen to become dirty, up to the given timeout. Uses a while loop to guard against spurious wakeups.
      Parameters:
      timeout - maximum time to wait in milliseconds; if <= 0, returns immediately
      Returns:
      true if the screen is dirty
      Throws:
      InterruptedException - if interrupted while waiting
    • setDirty

      protected void setDirty()
    • setSize

      public boolean setSize(int w, int h)
    • read

      public String read()
    • pipe

      public String pipe(String d)
    • write

      public boolean write(CharSequence d)
    • dump

      public void dump(long[] fullscreen, int ftop, int fleft, int fheight, int fwidth, int[] cursor)
    • dump

      public String dump(long timeout, boolean forceDump) throws InterruptedException
      Throws:
      InterruptedException
    • toString

      public String toString()
      Overrides:
      toString in class Object