|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjline.Terminal
jline.WindowsTerminal
Terminal implementation for Microsoft Windows. Terminal initialization
in initializeTerminal()
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.disableDirectConsole
system
property to true
.
Field Summary | |
private java.lang.Boolean |
directConsole
|
private static int |
ENABLE_ECHO_INPUT
Characters read by the ReadFile or ReadConsole function are written to the active screen buffer as they are read. |
private static int |
ENABLE_LINE_INPUT
The ReadFile or ReadConsole function returns only when a carriage return character is read. |
private static int |
ENABLE_MOUSE_INPUT
If the mouse pointer is within the borders of the console window and the window has the keyboard focus, mouse events generated by mouse movement and button presses are placed in the input buffer. |
private static int |
ENABLE_PROCESSED_INPUT
CTRL+C is processed by the system and is not placed in the input buffer. |
private static int |
ENABLE_PROCESSED_OUTPUT
When enabled, text entered in a console window will be inserted at the current cursor location and all text following that location will not be overwritten. |
private static int |
ENABLE_WINDOW_INPUT
User interactions that change the size of the console screen buffer are reported in the console's input buffee. |
private static int |
ENABLE_WRAP_AT_EOL_OUTPUT
This flag enables the user to use the mouse to select and edit text. |
Fields inherited from class jline.Terminal |
|
Fields inherited from interface jline.ConsoleOperations |
ADD, BACKSPACE, CHANGE_CASE, CHANGE_META, CLEAR_SCREEN, COMPLETE, CR, CTRL_A, CTRL_B, CTRL_C, CTRL_D, CTRL_E, CTRL_F, CTRL_N, CTRL_P, DELETE_META, DELETE_NEXT_CHAR, DELETE_PREV_CHAR, DELETE_PREV_WORD, END_WORD, EXIT, INSERT, KEYBOARD_BELL, KILL_LINE, KILL_LINE_PREV, MOVE_TO_BEG, MOVE_TO_END, NEWLINE, NEXT_CHAR, NEXT_HISTORY, NEXT_SPACE_WORD, NEXT_WORD, PASTE, PASTE_NEXT, PASTE_PREV, PREV_CHAR, PREV_HISTORY, PREV_SPACE_WORD, PREV_WORD, REDISPLAY, REPEAT_NEXT_CHAR, REPEAT_PREV_CHAR, REPEAT_SEARCH_NEXT, REPEAT_SEARCH_PREV, REPLACE_CHAR, REPLACE_MODE, RESET_LINE, SEARCH_NEXT, SEARCH_PREV, SUBSTITUTE_CHAR, SUBSTITUTE_LINE, TO_END_WORD, TO_NEXT_CHAR, TO_PREV_CHAR, UNDO, UNKNOWN |
Constructor Summary | |
WindowsTerminal()
|
Method Summary | |
private void |
consumeException(java.lang.Throwable e)
No-op for exceptions we want to silently consume. |
private int |
getConsoleMode()
|
java.lang.Boolean |
getDirectConsole()
Whether or not to allow the use of the JNI console interaction. |
boolean |
getEcho()
Returns true if the terminal will echo all characters type. |
int |
getTerminalHeight()
Unsupported; return the default. |
int |
getTerminalWidth()
Unsupported; return the default. |
private int |
getWindowsTerminalHeight()
|
private int |
getWindowsTerminalWidth()
|
void |
initializeTerminal()
Initialize any system settings that are required for the console to be able to handle input correctly, such as setting tabtop, buffered input, and character echo. |
boolean |
isANSISupported()
Windows doesn't support ANSI codes by default; disable them. |
boolean |
isSupported()
Returns true if this terminal is capable of initializing the terminal to use jline. |
private void |
loadLibrary(java.lang.String name)
|
private int |
readByte()
|
int |
readCharacter(java.io.InputStream in)
Read a single character from the input stream. |
int |
readVirtualKey(java.io.InputStream in)
Reads a virtual key from the console. |
private void |
setConsoleMode(int mode)
|
void |
setDirectConsole(java.lang.Boolean directConsole)
Whether or not to allow the use of the JNI console interaction. |
Methods inherited from class jline.Terminal |
afterReadLine, beforeReadLine, getTerminal, setupTerminal |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final int ENABLE_LINE_INPUT
private static final int ENABLE_ECHO_INPUT
private static final int ENABLE_PROCESSED_INPUT
private static final int ENABLE_WINDOW_INPUT
private static final int ENABLE_MOUSE_INPUT
private static final int ENABLE_PROCESSED_OUTPUT
private static final int ENABLE_WRAP_AT_EOL_OUTPUT
private java.lang.Boolean directConsole
Constructor Detail |
public WindowsTerminal()
Method Detail |
private int getConsoleMode()
private void setConsoleMode(int mode)
private int readByte()
private int getWindowsTerminalWidth()
private int getWindowsTerminalHeight()
public int readCharacter(java.io.InputStream in) throws java.io.IOException
Terminal
readCharacter
in class Terminal
java.io.IOException
public void initializeTerminal() throws java.lang.Exception
Terminal
initializeTerminal
in class Terminal
java.lang.Exception
private void loadLibrary(java.lang.String name) throws java.io.IOException
java.io.IOException
public int readVirtualKey(java.io.InputStream in) throws java.io.IOException
Terminal
readVirtualKey
in class Terminal
in
- the InputStream to read from
ConsoleOperations#VK_UP
)
java.io.IOException
public boolean isSupported()
Terminal
isSupported
in class Terminal
public boolean isANSISupported()
isANSISupported
in class Terminal
public boolean getEcho()
Terminal
getEcho
in class Terminal
public int getTerminalWidth()
getTerminalWidth
in class Terminal
Terminal.getTerminalWidth()
public int getTerminalHeight()
getTerminalHeight
in class Terminal
Terminal.getTerminalHeight()
private void consumeException(java.lang.Throwable e)
public void setDirectConsole(java.lang.Boolean directConsole)
public java.lang.Boolean getDirectConsole()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |