程序包 jline

类 UnixTerminal

java.lang.Object
jline.Terminal
jline.UnixTerminal
所有已实现的接口:
ConsoleOperations

public class UnixTerminal extends Terminal

Terminal that is used for unix platforms. Terminal initialization is handled by issuing the stty command against the /dev/tty file to disable character echoing and enable character input. All known unix systems (including Linux and Macintosh OS X) support the stty), so this implementation should work for an reasonable POSIX system.

作者:
Marc Prud'hommeaux, Updates Dale Kemp 2005-12-03
  • 字段详细资料

    • ARROW_START

      public static final short ARROW_START
      另请参阅:
    • ARROW_PREFIX

      public static final short ARROW_PREFIX
      另请参阅:
    • ARROW_LEFT

      public static final short ARROW_LEFT
      另请参阅:
    • ARROW_RIGHT

      public static final short ARROW_RIGHT
      另请参阅:
    • ARROW_UP

      public static final short ARROW_UP
      另请参阅:
    • ARROW_DOWN

      public static final short ARROW_DOWN
      另请参阅:
    • O_PREFIX

      public static final short O_PREFIX
      另请参阅:
    • HOME_CODE

      public static final short HOME_CODE
      另请参阅:
    • END_CODE

      public static final short END_CODE
      另请参阅:
    • DEL_THIRD

      public static final short DEL_THIRD
      另请参阅:
    • DEL_SECOND

      public static final short DEL_SECOND
      另请参阅:
  • 构造器详细资料

    • UnixTerminal

      public UnixTerminal()
  • 方法详细资料

    • checkBackspace

      protected void checkBackspace()
    • initializeTerminal

      public void initializeTerminal() throws IOException, InterruptedException
      Remove line-buffered input by invoking "stty -icanon min 1" against the current terminal.
      指定者:
      initializeTerminal 在类中 Terminal
      抛出:
      IOException
      InterruptedException
    • restoreTerminal

      public void restoreTerminal() throws Exception
      Restore the original terminal configuration, which can be used when shutting down the console reader. The ConsoleReader cannot be used after calling this method.
      抛出:
      Exception
    • readVirtualKey

      public int readVirtualKey(InputStream in) throws IOException
      从类复制的说明: Terminal
      Reads a virtual key from the console. Typically, this will just be the raw character that was entered, but in some cases, multiple input keys will need to be translated into a single virtual key.
      覆盖:
      readVirtualKey 在类中 Terminal
      参数:
      in - the InputStream to read from
      返回:
      the virtual key (e.g., ConsoleOperations#VK_UP)
      抛出:
      IOException
    • isSupported

      public boolean isSupported()
      从类复制的说明: Terminal
      Returns true if this terminal is capable of initializing the terminal to use jline.
      指定者:
      isSupported 在类中 Terminal
    • getEcho

      public boolean getEcho()
      从类复制的说明: Terminal
      Returns true if the terminal will echo all characters type.
      指定者:
      getEcho 在类中 Terminal
    • getTerminalWidth

      public int getTerminalWidth()
      Returns the value of "stty size" width param. Note: this method caches the value from the first time it is called in order to increase speed, which means that changing to size of the terminal will not be reflected in the console.
      指定者:
      getTerminalWidth 在类中 Terminal
    • getTerminalHeight

      public int getTerminalHeight()
      Returns the value of "stty size" height param. Note: this method caches the value from the first time it is called in order to increase speed, which means that changing to size of the terminal will not be reflected in the console.
      指定者:
      getTerminalHeight 在类中 Terminal
    • stty

      protected static String stty(String args) throws IOException, InterruptedException
      Execute the stty command with the specified arguments against the current active terminal.
      抛出:
      IOException
      InterruptedException
    • setSttyCommand

      public static void setSttyCommand(String cmd)
      The command to use to set the terminal options. Defaults to "stty", or the value of the system property "jline.sttyCommand".
    • getSttyCommand

      public static String getSttyCommand()
      The command to use to set the terminal options. Defaults to "stty", or the value of the system property "jline.sttyCommand".
    • isEchoEnabled

      public boolean isEchoEnabled()
      从类复制的说明: Terminal
      Returns false if character echoing is disabled.
      指定者:
      isEchoEnabled 在类中 Terminal
    • enableEcho

      public void enableEcho()
      从类复制的说明: Terminal
      Enable character echoing. This can be used to re-enable character if the ConsoleReader is no longer being used.
      指定者:
      enableEcho 在类中 Terminal
    • disableEcho

      public void disableEcho()
      从类复制的说明: Terminal
      Disable character echoing. This can be used to manually re-enable character if the ConsoleReader has been disabled.
      指定者:
      disableEcho 在类中 Terminal