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 voiddisableInterruptCharacter()voiddisableLitteralNextCharacter()voidenableInterruptCharacter()voidenableLitteralNextCharacter()booleangetBooleanCapability(java.lang.String capability)intgetHeight()Returns the value of stty rows>/tt> param.java.lang.IntegergetNumericCapability(java.lang.String capability)TerminalLineSettingsgetSettings()java.lang.StringgetStringCapability(java.lang.String capability)intgetWidth()Returns the value of stty columns param.booleanhasWeirdWrap()Defaults to true which was the behaviour before this method was added.voidinit()Remove line-buffered input by invoking "stty -icanon min 1" against the current terminal.voidrestore()Restore the original terminal configuration, which can be used when shutting down the console reader.voidsetEchoEnabled(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.ExceptionRemove line-buffered input by invoking "stty -icanon min 1" against the current terminal.- Specified by:
initin interfaceTerminal- Overrides:
initin classTerminalSupport- Throws:
java.lang.Exception
-
restore
public void restore() throws java.lang.ExceptionRestore 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:
restorein interfaceTerminal- Overrides:
restorein classTerminalSupport- Throws:
java.lang.Exception
-
getWidth
public int getWidth()
Returns the value of stty columns param.- Specified by:
getWidthin interfaceTerminal- Overrides:
getWidthin classTerminalSupport
-
getHeight
public int getHeight()
Returns the value of stty rows>/tt> param.- Specified by:
getHeightin interfaceTerminal- Overrides:
getHeightin classTerminalSupport
-
hasWeirdWrap
public boolean hasWeirdWrap()
Description copied from class:TerminalSupportDefaults to true which was the behaviour before this method was added.- Specified by:
hasWeirdWrapin interfaceTerminal- Overrides:
hasWeirdWrapin classTerminalSupport
-
setEchoEnabled
public void setEchoEnabled(boolean enabled)
- Specified by:
setEchoEnabledin interfaceTerminal- Overrides:
setEchoEnabledin classTerminalSupport
-
disableInterruptCharacter
public void disableInterruptCharacter()
- Specified by:
disableInterruptCharacterin interfaceTerminal- Overrides:
disableInterruptCharacterin classTerminalSupport
-
enableInterruptCharacter
public void enableInterruptCharacter()
- Specified by:
enableInterruptCharacterin interfaceTerminal- Overrides:
enableInterruptCharacterin classTerminalSupport
-
disableLitteralNextCharacter
public void disableLitteralNextCharacter()
-
enableLitteralNextCharacter
public void enableLitteralNextCharacter()
-
getBooleanCapability
public boolean getBooleanCapability(java.lang.String capability)
- Specified by:
getBooleanCapabilityin interfaceTerminal2
-
getNumericCapability
public java.lang.Integer getNumericCapability(java.lang.String capability)
- Specified by:
getNumericCapabilityin interfaceTerminal2
-
getStringCapability
public java.lang.String getStringCapability(java.lang.String capability)
- Specified by:
getStringCapabilityin interfaceTerminal2
-
-