jline
Class WindowsTerminal
java.lang.Object
jline.TerminalSupport
jline.WindowsTerminal
- All Implemented Interfaces:
- Terminal
- Direct Known Subclasses:
- AnsiWindowsTerminal
public class WindowsTerminal
- extends TerminalSupport
Terminal implementation for Microsoft Windows. Terminal initialization in
init() is accomplished by extracting the
jline_version.dll, saving it to the system temporary
directoy (determined by the setting of the java.io.tmpdir System
property), loading the library, and then calling the Win32 APIs SetConsoleMode and
GetConsoleMode to
disable character echoing.
By default, the wrapInIfNeeded(java.io.InputStream) method will attempt
to test to see if the specified InputStream is System.in or a wrapper
around FileDescriptor.in, and if so, will bypass the character reading to
directly invoke the readc() method in the JNI library. This is so the class
can read special keys (like arrow keys) which are otherwise inaccessible via
the System.in stream. Using JNI reading can be bypassed by setting
the jline.WindowsTerminal.directConsole system property
to false.
- Since:
- 2.0
- Author:
- Marc Prud'hommeaux, Jason Dillon
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DIRECT_CONSOLE
public static final String DIRECT_CONSOLE
ANSI
public static final String ANSI
WindowsTerminal
public WindowsTerminal()
throws Exception
- Throws:
Exception
init
public void init()
throws Exception
- Specified by:
init in interface Terminal- Overrides:
init in class TerminalSupport
- Throws:
Exception
restore
public void restore()
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.
- Specified by:
restore in interface Terminal- Overrides:
restore in class TerminalSupport
- Throws:
Exception
getWidth
public int getWidth()
- Specified by:
getWidth in interface Terminal- Overrides:
getWidth in class TerminalSupport
getHeight
public int getHeight()
- 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
setDirectConsole
public void setDirectConsole(boolean flag)
- Whether or not to allow the use of the JNI console interaction.
getDirectConsole
public Boolean getDirectConsole()
- Whether or not to allow the use of the JNI console interaction.
wrapInIfNeeded
public InputStream wrapInIfNeeded(InputStream in)
throws IOException
- Description copied from interface:
Terminal
- When using native support, return the InputStream to use for reading characters
else return the input stream passed as a parameter.
- Specified by:
wrapInIfNeeded in interface Terminal- Overrides:
wrapInIfNeeded in class TerminalSupport
- Throws:
IOException
isSystemIn
protected boolean isSystemIn(InputStream in)
throws IOException
- Throws:
IOException
Copyright © 2013. All Rights Reserved.