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 readCharacter(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 |
JLINE_WINDOWS_TERMINAL_INPUT_ENCODING
public static final java.lang.String JLINE_WINDOWS_TERMINAL_INPUT_ENCODING
- See Also:
- Constant Field Values
JLINE_WINDOWS_TERMINAL_OUTPUT_ENCODING
public static final java.lang.String JLINE_WINDOWS_TERMINAL_OUTPUT_ENCODING
- See Also:
- Constant Field Values
JLINE_WINDOWS_TERMINAL_DIRECT_CONSOLE
public static final java.lang.String JLINE_WINDOWS_TERMINAL_DIRECT_CONSOLE
- See Also:
- Constant Field Values
WINDOWSBINDINGS_PROPERTIES
public static final java.lang.String WINDOWSBINDINGS_PROPERTIES
- See Also:
- Constant Field Values
ANSI
public static final java.lang.String ANSI
WindowsTerminal
public WindowsTerminal()
throws java.lang.Exception
- Throws:
java.lang.Exception
init
public void init()
throws java.lang.Exception
- 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()
- 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 java.lang.Boolean getDirectConsole()
- Whether or not to allow the use of the JNI console interaction.
readCharacter
public int readCharacter(java.io.InputStream in)
throws java.io.IOException
- Specified by:
readCharacter
in interface Terminal
- Overrides:
readCharacter
in class TerminalSupport
- Throws:
java.io.IOException
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
getDefaultBindings
public java.io.InputStream getDefaultBindings()
- Specified by:
getDefaultBindings
in interface Terminal
- Overrides:
getDefaultBindings
in class TerminalSupport