public class WindowsTerminal extends TerminalSupport
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
WindowsTerminal.ConsoleMode
Console mode
Constants copied wincon.h.
|
static class |
WindowsTerminal.WindowsKey
Windows keys.
|
TerminalSupport.RestoreHook| Modifier and Type | Field and Description |
|---|---|
static String |
ANSI |
static String |
JLINE_WINDOWS_TERMINAL_DIRECT_CONSOLE |
static String |
JLINE_WINDOWS_TERMINAL_INPUT_ENCODING |
static String |
JLINE_WINDOWS_TERMINAL_OUTPUT_ENCODING |
static String |
WINDOWSBINDINGS_PROPERTIES |
DEFAULT_HEIGHT, DEFAULT_KEYBINDINGS_PROPERTIES, DEFAULT_WIDTH| Constructor and Description |
|---|
WindowsTerminal() |
| Modifier and Type | Method and Description |
|---|---|
InputStream |
getDefaultBindings() |
Boolean |
getDirectConsole()
Whether or not to allow the use of the JNI console interaction.
|
int |
getHeight() |
int |
getWidth() |
void |
init() |
int |
readCharacter(InputStream in) |
int |
readVirtualKey(InputStream in) |
void |
restore()
Restore the original terminal configuration, which can be used when
shutting down the console reader.
|
void |
setDirectConsole(boolean flag)
Whether or not to allow the use of the JNI console interaction.
|
void |
setEchoEnabled(boolean enabled) |
installShutdownHook, isAnsiSupported, isEchoEnabled, isSupported, removeShutdownHook, reset, setAnsiSupportedpublic static final String JLINE_WINDOWS_TERMINAL_INPUT_ENCODING
public static final String JLINE_WINDOWS_TERMINAL_OUTPUT_ENCODING
public static final String JLINE_WINDOWS_TERMINAL_DIRECT_CONSOLE
public static final String WINDOWSBINDINGS_PROPERTIES
public static final String ANSI
public void init()
throws Exception
init in interface Terminalinit in class TerminalSupportExceptionpublic void restore()
throws Exception
restore in interface Terminalrestore in class TerminalSupportExceptionpublic int getWidth()
getWidth in interface TerminalgetWidth in class TerminalSupportpublic int getHeight()
getHeight in interface TerminalgetHeight in class TerminalSupportpublic void setEchoEnabled(boolean enabled)
setEchoEnabled in interface TerminalsetEchoEnabled in class TerminalSupportpublic void setDirectConsole(boolean flag)
public Boolean getDirectConsole()
public int readCharacter(InputStream in) throws IOException
readCharacter in interface TerminalreadCharacter in class TerminalSupportIOExceptionpublic int readVirtualKey(InputStream in) throws IOException
readVirtualKey in interface TerminalreadVirtualKey in class TerminalSupportIOExceptionpublic InputStream getDefaultBindings()
getDefaultBindings in interface TerminalgetDefaultBindings in class TerminalSupportCopyright © 2008-2013 Sonatype. All Rights Reserved.