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 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.
| Modifier and Type | Class and Description |
|---|---|
static class |
WindowsTerminal.ConsoleMode
Console mode
Constants copied wincon.h.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
ANSI |
static String |
DIRECT_CONSOLE |
DEFAULT_HEIGHT, DEFAULT_WIDTH| Constructor and Description |
|---|
WindowsTerminal() |
| Modifier and Type | Method and Description |
|---|---|
Boolean |
getDirectConsole()
Whether or not to allow the use of the JNI console interaction.
|
int |
getHeight() |
String |
getOutputEncoding() |
int |
getWidth() |
void |
init() |
protected boolean |
isSystemIn(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) |
InputStream |
wrapInIfNeeded(InputStream in)
When using native support, return the InputStream to use for reading characters
else return the input stream passed as a parameter.
|
hasWeirdWrap, isAnsiSupported, isEchoEnabled, isSupported, reset, setAnsiSupported, wrapOutIfNeededpublic static final String DIRECT_CONSOLE
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 InputStream wrapInIfNeeded(InputStream in) throws IOException
TerminalwrapInIfNeeded in interface TerminalwrapInIfNeeded in class TerminalSupportIOExceptionprotected boolean isSystemIn(InputStream in) throws IOException
IOExceptionpublic String getOutputEncoding()
getOutputEncoding in interface TerminalgetOutputEncoding in class TerminalSupportCopyright © 2014. All Rights Reserved.