jline
Class UnixTerminal
java.lang.Object
jline.TerminalSupport
jline.UnixTerminal
- All Implemented Interfaces:
- Terminal
- Direct Known Subclasses:
- NoInterruptUnixTerminal
public class UnixTerminal
- extends TerminalSupport
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.
- Since:
- 2.0
- Author:
- Marc Prud'hommeaux, Dale Kemp, Jason Dillon, Jean-Baptiste Onofr??
|
Method Summary |
int |
getHeight()
Returns the value of stty rows>/tt> param. |
protected TerminalLineSettings |
getSettings()
|
int |
getWidth()
Returns the value of stty columns param. |
void |
init()
Remove line-buffered input by invoking "stty -icanon min 1"
against the current terminal. |
int |
readVirtualKey(java.io.InputStream in)
|
void |
restore()
Restore the original terminal configuration, which can be used when
shutting down the console reader. |
void |
setEchoEnabled(boolean enabled)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
UnixTerminal
public UnixTerminal()
throws java.lang.Exception
- Throws:
java.lang.Exception
getSettings
protected TerminalLineSettings getSettings()
init
public void init()
throws java.lang.Exception
- Remove line-buffered input by invoking "stty -icanon min 1"
against the current terminal.
- Specified by:
init in interface Terminal- Overrides:
init in class TerminalSupport
- Throws:
java.lang.Exception
restore
public void restore()
throws java.lang.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.
- Specified by:
restore in interface Terminal- Overrides:
restore in class TerminalSupport
- Throws:
java.lang.Exception
getWidth
public int getWidth()
- Returns the value of stty columns param.
- Specified by:
getWidth in interface Terminal- Overrides:
getWidth in class TerminalSupport
getHeight
public int getHeight()
- Returns the value of stty rows>/tt> param.
- Specified by:
getHeight in interface Terminal- Overrides:
getHeight in class TerminalSupport
setEchoEnabled
public void setEchoEnabled(boolean enabled)
- Specified by:
setEchoEnabled in interface Terminal- Overrides:
setEchoEnabled in class TerminalSupport
readVirtualKey
public int readVirtualKey(java.io.InputStream in)
throws java.io.IOException
- Specified by:
readVirtualKey in interface Terminal- Overrides:
readVirtualKey in class TerminalSupport
- Throws:
java.io.IOException