Class ISO6429Terminal


  • public class ISO6429Terminal
    extends Object
    A basic implementation of an ISO 6429 terminal. This sends along device control characters to do hardware cursor addressing using standard I/O. Several caveats come with this.
    • This is not a complete implementation -- the spec. even states a full implementation is not possible. We want to allow for a command history and several other things which Java just does not do consistently cross platform.
    • The old ANSI (late 1970's) terminal standard was replaced by the ECMA-48 (early 1990's) standard which in turn was replaced by the ISO 6429 standard (in the 2000's). This means that ANSI terminals do support this.
    • Unix command lines are de facto ANSI standard because they started that way and nobody wants to invest the time to change it. In theory this might not work in some unix environments.
    • DOS and therefore Windows did not support ANSI natively. As of Windows 10, however, their command line support the ISO standard. This means that by and large this should now work with Unix, Windows and Mac. For Windows users, it may require some configuration in the OS to enable ANSI support in command lines though.
    Typically, if the device does not support this, you start seeing sets of weird characters around your text. A bunch of control sequence are pretty well laid out here : https://en.wikipedia.org/wiki/ANSI_escape_code

    Created by Jeff Gaynor
    on 6/5/20 at 8:42 AM

    • Field Detail

      • reader

        protected org.jline.utils.NonBlockingReader reader
    • Method Detail

      • getName

        public String getName()
      • setCursorCol

        public void setCursorCol​(int col)
      • setCursor

        public void setCursor​(int row,
                              int col)
      • clearLine

        public void clearLine​(int startCol)
        clear the entire current line. Put the cursor at the front of the line
      • setColor

        public void setColor​(int color)
      • setBold

        public void setBold​(boolean setOn)
      • getKeyRemap

        protected KeyStroke getKeyRemap​(char y)
                                 throws IOException
        If you want to add key remappings (like QDL) override this.
        Parameters:
        y - the second byte after and escape from the terminal. If there is no more input after that, interpret it as being an alt or other key stroke.
        Returns:
        Throws:
        IOException
      • main

        public static void main​(String[] args)
        You can run this with mvn compile exec:java -Dexec.mainClass="edu.uiuc.ncsa.security.util.terminal.ISO6429Terminal"
        Parameters:
        args -
      • info

        protected void info​(String x)
      • debug

        protected void debug​(String x)