Class Curses


  • public final class Curses
    extends java.lang.Object
    Utility class for terminal cursor and screen manipulation using ANSI escape sequences.

    The Curses class provides methods for manipulating the terminal display using ANSI escape sequences and terminal capabilities. It includes functionality for cursor movement, screen clearing, text attributes, and other terminal operations.

    This class is named after the curses library commonly used in Unix-like systems for terminal control, though it provides a simplified subset of functionality. It handles the complexities of formatting and interpreting terminal capability strings, allowing for portable terminal manipulation across different terminal types.

    Key features include:

    • Cursor positioning and movement
    • Screen and line clearing
    • Text attribute control (bold, underline, etc.)
    • Color manipulation
    • Terminal capability string parsing and execution

    This class is used internally by JLine components to perform terminal operations in a consistent way across different terminal types and platforms.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void tputs​(java.lang.Appendable out, java.lang.String str, java.lang.Object... params)
      Print the given terminal capabilities
      static java.lang.String tputs​(java.lang.String cap, java.lang.Object... params)
      Print the given terminal capabilities
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • tputs

        public static java.lang.String tputs​(java.lang.String cap,
                                             java.lang.Object... params)
        Print the given terminal capabilities
        Parameters:
        cap - the capability to output
        params - optional parameters
        Returns:
        the result string
      • tputs

        public static void tputs​(java.lang.Appendable out,
                                 java.lang.String str,
                                 java.lang.Object... params)
        Print the given terminal capabilities
        Parameters:
        out - the output stream
        str - the capability to output
        params - optional parameters