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, setAnsiSupported
public 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 Terminal
init
in class TerminalSupport
Exception
public void restore() throws Exception
restore
in interface Terminal
restore
in class TerminalSupport
Exception
public int getWidth()
getWidth
in interface Terminal
getWidth
in class TerminalSupport
public int getHeight()
getHeight
in interface Terminal
getHeight
in class TerminalSupport
public void setEchoEnabled(boolean enabled)
setEchoEnabled
in interface Terminal
setEchoEnabled
in class TerminalSupport
public void setDirectConsole(boolean flag)
public Boolean getDirectConsole()
public int readCharacter(InputStream in) throws IOException
readCharacter
in interface Terminal
readCharacter
in class TerminalSupport
IOException
public int readVirtualKey(InputStream in) throws IOException
readVirtualKey
in interface Terminal
readVirtualKey
in class TerminalSupport
IOException
public InputStream getDefaultBindings()
getDefaultBindings
in interface Terminal
getDefaultBindings
in class TerminalSupport
Copyright © 2008-2012 Sonatype. All Rights Reserved.