Package jline
Class UnixTerminal
- java.lang.Object
-
- jline.TerminalSupport
-
- jline.UnixTerminal
-
- Direct Known Subclasses:
NoInterruptUnixTerminal
public class UnixTerminal extends TerminalSupport implements Terminal2
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��
-
-
Field Summary
-
Fields inherited from class jline.TerminalSupport
DEFAULT_HEIGHT, DEFAULT_WIDTH
-
-
Constructor Summary
Constructors Constructor Description UnixTerminal()
UnixTerminal(java.lang.String ttyDevice)
UnixTerminal(java.lang.String ttyDevice, java.lang.String type)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disableInterruptCharacter()
void
disableLitteralNextCharacter()
void
enableInterruptCharacter()
void
enableLitteralNextCharacter()
boolean
getBooleanCapability(java.lang.String capability)
int
getHeight()
Returns the value of stty rows>/tt> param.java.lang.Integer
getNumericCapability(java.lang.String capability)
TerminalLineSettings
getSettings()
java.lang.String
getStringCapability(java.lang.String capability)
int
getWidth()
Returns the value of stty columns param.boolean
hasWeirdWrap()
Defaults to true which was the behaviour before this method was added.void
init()
Remove line-buffered input by invoking "stty -icanon min 1" against the current terminal.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 jline.TerminalSupport
getOutputEncoding, isAnsiSupported, isEchoEnabled, isSupported, reset, setAnsiSupported, wrapInIfNeeded, wrapOutIfNeeded
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jline.Terminal
getOutputEncoding, isAnsiSupported, isEchoEnabled, isSupported, reset, wrapInIfNeeded, wrapOutIfNeeded
-
-
-
-
Constructor Detail
-
UnixTerminal
public UnixTerminal() throws java.lang.Exception
- Throws:
java.lang.Exception
-
UnixTerminal
public UnixTerminal(java.lang.String ttyDevice) throws java.lang.Exception
- Throws:
java.lang.Exception
-
UnixTerminal
public UnixTerminal(java.lang.String ttyDevice, java.lang.String type) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-
Method Detail
-
getSettings
public 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 interfaceTerminal
- Overrides:
init
in classTerminalSupport
- 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 interfaceTerminal
- Overrides:
restore
in classTerminalSupport
- Throws:
java.lang.Exception
-
getWidth
public int getWidth()
Returns the value of stty columns param.- Specified by:
getWidth
in interfaceTerminal
- Overrides:
getWidth
in classTerminalSupport
-
getHeight
public int getHeight()
Returns the value of stty rows>/tt> param.- Specified by:
getHeight
in interfaceTerminal
- Overrides:
getHeight
in classTerminalSupport
-
hasWeirdWrap
public boolean hasWeirdWrap()
Description copied from class:TerminalSupport
Defaults to true which was the behaviour before this method was added.- Specified by:
hasWeirdWrap
in interfaceTerminal
- Overrides:
hasWeirdWrap
in classTerminalSupport
-
setEchoEnabled
public void setEchoEnabled(boolean enabled)
- Specified by:
setEchoEnabled
in interfaceTerminal
- Overrides:
setEchoEnabled
in classTerminalSupport
-
disableInterruptCharacter
public void disableInterruptCharacter()
- Specified by:
disableInterruptCharacter
in interfaceTerminal
- Overrides:
disableInterruptCharacter
in classTerminalSupport
-
enableInterruptCharacter
public void enableInterruptCharacter()
- Specified by:
enableInterruptCharacter
in interfaceTerminal
- Overrides:
enableInterruptCharacter
in classTerminalSupport
-
disableLitteralNextCharacter
public void disableLitteralNextCharacter()
-
enableLitteralNextCharacter
public void enableLitteralNextCharacter()
-
getBooleanCapability
public boolean getBooleanCapability(java.lang.String capability)
- Specified by:
getBooleanCapability
in interfaceTerminal2
-
getNumericCapability
public java.lang.Integer getNumericCapability(java.lang.String capability)
- Specified by:
getNumericCapability
in interfaceTerminal2
-
getStringCapability
public java.lang.String getStringCapability(java.lang.String capability)
- Specified by:
getStringCapability
in interfaceTerminal2
-
-