Class AnsiProcessor

java.lang.Object
org.jline.jansi.io.AnsiProcessor
Direct Known Subclasses:
ColorsAnsiProcessor, WindowsAnsiProcessor

public class AnsiProcessor extends Object
ANSI processor providing process* corresponding to ANSI escape codes. This class methods implementations are empty: subclasses should actually perform the ANSI escape behaviors by implementing active code in process* methods.

For more information about ANSI escape codes, see Wikipedia article

Since:
1.19
  • Field Details

  • Constructor Details

  • Method Details

    • getNextOptionInt

      protected int getNextOptionInt(Iterator<Object> optionsIterator) throws IOException
      Helper for processEscapeCommand() to iterate over integer options
      Parameters:
      optionsIterator - the underlying iterator
      Throws:
      IOException - if no more non-null values left
    • processEscapeCommand

      protected boolean processEscapeCommand(ArrayList<Object> options, int command) throws IOException
      Returns:
      true if the escape command was processed.
      Throws:
      IOException
    • processOperatingSystemCommand

      protected boolean processOperatingSystemCommand(ArrayList<Object> options)
      Returns:
      true if the operating system command was processed.
    • processCharsetSelect

      protected boolean processCharsetSelect(ArrayList<Object> options)
      Process character set sequence.
      Parameters:
      options - options
      Returns:
      true if the charcter set select command was processed.
    • processRestoreCursorPosition

      protected void processRestoreCursorPosition() throws IOException
      Process CSI u ANSI code, corresponding to RCP – Restore Cursor Position
      Throws:
      IOException - IOException
    • processSaveCursorPosition

      protected void processSaveCursorPosition() throws IOException
      Process CSI s ANSI code, corresponding to SCP – Save Cursor Position
      Throws:
      IOException - IOException
    • processInsertLine

      protected void processInsertLine(int optionInt) throws IOException
      Process CSI L ANSI code, corresponding to IL – Insert Line
      Parameters:
      optionInt - option
      Throws:
      IOException - IOException
      Since:
      1.16
    • processDeleteLine

      protected void processDeleteLine(int optionInt) throws IOException
      Process CSI M ANSI code, corresponding to DL – Delete Line
      Parameters:
      optionInt - option
      Throws:
      IOException - IOException
      Since:
      1.16
    • processScrollDown

      protected void processScrollDown(int optionInt) throws IOException
      Process CSI n T ANSI code, corresponding to SD – Scroll Down
      Parameters:
      optionInt - option
      Throws:
      IOException - IOException
    • processScrollUp

      protected void processScrollUp(int optionInt) throws IOException
      Process CSI n U ANSI code, corresponding to SU – Scroll Up
      Parameters:
      optionInt - option
      Throws:
      IOException - IOException
    • processEraseScreen

      protected void processEraseScreen(int eraseOption) throws IOException
      Process CSI n J ANSI code, corresponding to ED – Erase in Display
      Parameters:
      eraseOption - eraseOption
      Throws:
      IOException - IOException
    • processEraseLine

      protected void processEraseLine(int eraseOption) throws IOException
      Process CSI n K ANSI code, corresponding to ED – Erase in Line
      Parameters:
      eraseOption - eraseOption
      Throws:
      IOException - IOException
    • processSetAttribute

      protected void processSetAttribute(int attribute) throws IOException
      process SGR other than 0 (reset), 30-39 (foreground), 40-49 (background), 90-97 (foreground high intensity) or 100-107 (background high intensity)
      Parameters:
      attribute - attribute
      Throws:
      IOException - IOException
      See Also:
    • processSetForegroundColor

      protected void processSetForegroundColor(int color) throws IOException
      process SGR 30-37 corresponding to Set text color (foreground).
      Parameters:
      color - the text color
      Throws:
      IOException - IOException
    • processSetForegroundColor

      protected void processSetForegroundColor(int color, boolean bright) throws IOException
      process SGR 30-37 or SGR 90-97 corresponding to Set text color (foreground) either in normal mode or high intensity.
      Parameters:
      color - the text color
      bright - is high intensity?
      Throws:
      IOException - IOException
    • processSetForegroundColorExt

      protected void processSetForegroundColorExt(int paletteIndex) throws IOException
      process SGR 38 corresponding to extended set text color (foreground) with a palette of 255 colors.
      Parameters:
      paletteIndex - the text color in the palette
      Throws:
      IOException - IOException
    • processSetForegroundColorExt

      protected void processSetForegroundColorExt(int r, int g, int b) throws IOException
      process SGR 38 corresponding to extended set text color (foreground) with a 24 bits RGB definition of the color.
      Parameters:
      r - red
      g - green
      b - blue
      Throws:
      IOException - IOException
    • processSetBackgroundColor

      protected void processSetBackgroundColor(int color) throws IOException
      process SGR 40-47 corresponding to Set background color.
      Parameters:
      color - the background color
      Throws:
      IOException - IOException
    • processSetBackgroundColor

      protected void processSetBackgroundColor(int color, boolean bright) throws IOException
      process SGR 40-47 or SGR 100-107 corresponding to Set background color either in normal mode or high intensity.
      Parameters:
      color - the background color
      bright - is high intensity?
      Throws:
      IOException - IOException
    • processSetBackgroundColorExt

      protected void processSetBackgroundColorExt(int paletteIndex) throws IOException
      process SGR 48 corresponding to extended set background color with a palette of 255 colors.
      Parameters:
      paletteIndex - the background color in the palette
      Throws:
      IOException - IOException
    • processSetBackgroundColorExt

      protected void processSetBackgroundColorExt(int r, int g, int b) throws IOException
      process SGR 48 corresponding to extended set background color with a 24 bits RGB definition of the color.
      Parameters:
      r - red
      g - green
      b - blue
      Throws:
      IOException - IOException
    • processDefaultTextColor

      protected void processDefaultTextColor() throws IOException
      process SGR 39 corresponding to Default text color (foreground)
      Throws:
      IOException - IOException
    • processDefaultBackgroundColor

      protected void processDefaultBackgroundColor() throws IOException
      process SGR 49 corresponding to Default background color
      Throws:
      IOException - IOException
    • processAttributeReset

      protected void processAttributeReset() throws IOException
      process SGR 0 corresponding to Reset / Normal
      Throws:
      IOException - IOException
    • processCursorTo

      protected void processCursorTo(int row, int col) throws IOException
      process CSI n ; m H corresponding to CUP – Cursor Position or CSI n ; m f corresponding to HVP – Horizontal and Vertical Position
      Parameters:
      row - row
      col - col
      Throws:
      IOException - IOException
    • processCursorToColumn

      protected void processCursorToColumn(int x) throws IOException
      process CSI n G corresponding to CHA – Cursor Horizontal Absolute
      Parameters:
      x - the column
      Throws:
      IOException - IOException
    • processCursorUpLine

      protected void processCursorUpLine(int count) throws IOException
      process CSI n F corresponding to CPL – Cursor Previous Line
      Parameters:
      count - line count
      Throws:
      IOException - IOException
    • processCursorDownLine

      protected void processCursorDownLine(int count) throws IOException
      process CSI n E corresponding to CNL – Cursor Next Line
      Parameters:
      count - line count
      Throws:
      IOException - IOException
    • processCursorLeft

      protected void processCursorLeft(int count) throws IOException
      process CSI n D corresponding to CUB – Cursor Back
      Parameters:
      count - count
      Throws:
      IOException - IOException
    • processCursorRight

      protected void processCursorRight(int count) throws IOException
      process CSI n C corresponding to CUF – Cursor Forward
      Parameters:
      count - count
      Throws:
      IOException - IOException
    • processCursorDown

      protected void processCursorDown(int count) throws IOException
      process CSI n B corresponding to CUD – Cursor Down
      Parameters:
      count - count
      Throws:
      IOException - IOException
    • processCursorUp

      protected void processCursorUp(int count) throws IOException
      process CSI n A corresponding to CUU – Cursor Up
      Parameters:
      count - count
      Throws:
      IOException - IOException
    • processUnknownExtension

      protected void processUnknownExtension(ArrayList<Object> options, int command)
      Process Unknown Extension
      Parameters:
      options - options
      command - command
    • processChangeIconNameAndWindowTitle

      protected void processChangeIconNameAndWindowTitle(String label)
      process OSC 0;text BEL corresponding to Change Window and Icon label
      Parameters:
      label - window title name
    • processChangeIconName

      protected void processChangeIconName(String label)
      process OSC 1;text BEL corresponding to Change Icon label
      Parameters:
      label - icon label
    • processChangeWindowTitle

      protected void processChangeWindowTitle(String label)
      process OSC 2;text BEL corresponding to Change Window title
      Parameters:
      label - window title text
    • processUnknownOperatingSystemCommand

      protected void processUnknownOperatingSystemCommand(int command, String param)
      Process unknown OSC command.
      Parameters:
      command - command
      param - param
    • processCharsetSelect

      protected void processCharsetSelect(int set, char seq)