jline

Class UnixTerminal

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.

Author: Marc Prud'hommeaux Updates Dale Kemp 2005-12-03

Field Summary
static shortARROW_DOWN
static shortARROW_LEFT
static shortARROW_PREFIX
static shortARROW_RIGHT
static shortARROW_START
static shortARROW_UP
static shortDEL_SECOND
static shortDEL_THIRD
static shortEND_CODE
static shortHOME_CODE
static shortO_PREFIX
Constructor Summary
UnixTerminal()
Method Summary
protected voidcheckBackspace()
voiddisableEcho()
voidenableEcho()
booleangetEcho()
static StringgetSttyCommand()
The command to use to set the terminal options.
intgetTerminalHeight()
Returns the value of "stty size" height param.
intgetTerminalWidth()
Returns the value of "stty size" width param.
voidinitializeTerminal()
Remove line-buffered input by invoking "stty -icanon min 1" against the current terminal.
booleanisEchoEnabled()
booleanisSupported()
intreadVirtualKey(InputStream in)
voidrestoreTerminal()
Restore the original terminal configuration, which can be used when shutting down the console reader.
static voidsetSttyCommand(String cmd)
The command to use to set the terminal options.

Field Detail

ARROW_DOWN

public static final short ARROW_DOWN

ARROW_LEFT

public static final short ARROW_LEFT

ARROW_PREFIX

public static final short ARROW_PREFIX

ARROW_RIGHT

public static final short ARROW_RIGHT

ARROW_START

public static final short ARROW_START

ARROW_UP

public static final short ARROW_UP

DEL_SECOND

public static final short DEL_SECOND

DEL_THIRD

public static final short DEL_THIRD

END_CODE

public static final short END_CODE

HOME_CODE

public static final short HOME_CODE

O_PREFIX

public static final short O_PREFIX

Constructor Detail

UnixTerminal

public UnixTerminal()

Method Detail

checkBackspace

protected void checkBackspace()

disableEcho

public void disableEcho()

enableEcho

public void enableEcho()

getEcho

public boolean getEcho()

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".

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.

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.

initializeTerminal

public void initializeTerminal()
Remove line-buffered input by invoking "stty -icanon min 1" against the current terminal.

isEchoEnabled

public boolean isEchoEnabled()

isSupported

public boolean isSupported()

readVirtualKey

public int readVirtualKey(InputStream in)

restoreTerminal

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

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".
Copyright © 2002-2008 null. All Rights Reserved.