类 WindowsTerminal
- 所有已实现的接口:
ConsoleOperations
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.directConsole
system property
to false
.
-
字段概要
字段修饰符和类型字段说明static final int
When following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates that the delete key was pressed.static final int
When following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates an down arrow key press.static final char
When following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates that the end key was pressed.static final char
When following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR, this character indicates that the escape key was pressed.static final int
When following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates that the home key was pressed.static final char
When following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates that the insert key was pressed.static final int
When following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR, this character indicates an left arrow key press.static final int
On windows terminals, this character indicates that a special key on the number pad has been pressed.static final char
When following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates that the page down key was pressed.static final char
When following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates that the page up key was pressed.static final int
When following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates an right arrow key press.static final int
On windows terminals, this character indicates that a 'special' key has been pressed.static final int
When following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates an up arrow key press.从接口继承的字段 jline.ConsoleOperations
ABORT, ADD, BACKSPACE, CHANGE_CASE, CHANGE_META, CLEAR_LINE, CLEAR_SCREEN, COMPLETE, CR, CTRL_A, CTRL_B, CTRL_C, CTRL_D, CTRL_E, CTRL_F, CTRL_G, CTRL_K, CTRL_L, CTRL_N, CTRL_OB, CTRL_P, CTRL_QM, DELETE, DELETE_META, DELETE_NEXT_CHAR, DELETE_PREV_CHAR, DELETE_PREV_WORD, END_OF_HISTORY, 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, START_OF_HISTORY, SUBSTITUTE_CHAR, SUBSTITUTE_LINE, TO_END_WORD, TO_NEXT_CHAR, TO_PREV_CHAR, UNDO, UNKNOWN
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明void
Disable character echoing.void
Enable character echoing.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
Unsupported; return the default.int
Unsupported; return the default.void
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
Windows doesn't support ANSI codes by default; disable them.boolean
Returns false if character echoing is disabled.boolean
Returns true if this terminal is capable of initializing the terminal to use jline.int
Read a single character from the input stream.int
Reads a virtual key from the console.void
setDirectConsole
(Boolean directConsole) Whether or not to allow the use of the JNI console interaction.从类继承的方法 jline.Terminal
afterReadLine, beforeReadLine, getTerminal, resetTerminal, setupTerminal
-
字段详细资料
-
SPECIAL_KEY_INDICATOR
public static final int SPECIAL_KEY_INDICATOROn windows terminals, this character indicates that a 'special' key has been pressed. This means that a key such as an arrow key, or delete, or home, etc. will be indicated by the next character.- 另请参阅:
-
NUMPAD_KEY_INDICATOR
public static final int NUMPAD_KEY_INDICATOROn windows terminals, this character indicates that a special key on the number pad has been pressed.- 另请参阅:
-
LEFT_ARROW_KEY
public static final int LEFT_ARROW_KEYWhen following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR, this character indicates an left arrow key press.- 另请参阅:
-
RIGHT_ARROW_KEY
public static final int RIGHT_ARROW_KEYWhen following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates an right arrow key press.- 另请参阅:
-
UP_ARROW_KEY
public static final int UP_ARROW_KEYWhen following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates an up arrow key press.- 另请参阅:
-
DOWN_ARROW_KEY
public static final int DOWN_ARROW_KEYWhen following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates an down arrow key press.- 另请参阅:
-
DELETE_KEY
public static final int DELETE_KEYWhen following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates that the delete key was pressed.- 另请参阅:
-
HOME_KEY
public static final int HOME_KEYWhen following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates that the home key was pressed.- 另请参阅:
-
END_KEY
public static final char END_KEYWhen following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates that the end key was pressed.- 另请参阅:
-
PAGE_UP_KEY
public static final char PAGE_UP_KEYWhen following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates that the page up key was pressed.- 另请参阅:
-
PAGE_DOWN_KEY
public static final char PAGE_DOWN_KEYWhen following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates that the page down key was pressed.- 另请参阅:
-
INSERT_KEY
public static final char INSERT_KEYWhen following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR this character indicates that the insert key was pressed.- 另请参阅:
-
ESCAPE_KEY
public static final char ESCAPE_KEYWhen following the SPECIAL_KEY_INDICATOR or NUMPAD_KEY_INDICATOR, this character indicates that the escape key was pressed.- 另请参阅:
-
-
构造器详细资料
-
WindowsTerminal
public WindowsTerminal()
-
-
方法详细资料
-
readCharacter
从类复制的说明:Terminal
Read a single character from the input stream. This might enable a terminal implementation to better handle nuances of the console.- 覆盖:
readCharacter
在类中Terminal
- 抛出:
IOException
-
initializeTerminal
从类复制的说明:Terminal
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.- 指定者:
initializeTerminal
在类中Terminal
- 抛出:
Exception
-
readVirtualKey
从类复制的说明:Terminal
Reads a virtual key from the console. Typically, this will just be the raw character that was entered, but in some cases, multiple input keys will need to be translated into a single virtual key.- 覆盖:
readVirtualKey
在类中Terminal
- 参数:
in
- the InputStream to read from- 返回:
- the virtual key (e.g.,
ConsoleOperations#VK_UP
) - 抛出:
IOException
-
isSupported
public boolean isSupported()从类复制的说明:Terminal
Returns true if this terminal is capable of initializing the terminal to use jline.- 指定者:
isSupported
在类中Terminal
-
isANSISupported
public boolean isANSISupported()Windows doesn't support ANSI codes by default; disable them.- 覆盖:
isANSISupported
在类中Terminal
-
getEcho
public boolean getEcho()从类复制的说明:Terminal
Returns true if the terminal will echo all characters type. -
getTerminalWidth
public int getTerminalWidth()Unsupported; return the default.- 指定者:
getTerminalWidth
在类中Terminal
- 另请参阅:
-
getTerminalHeight
public int getTerminalHeight()Unsupported; return the default.- 指定者:
getTerminalHeight
在类中Terminal
- 另请参阅:
-
setDirectConsole
Whether or not to allow the use of the JNI console interaction. -
getDirectConsole
Whether or not to allow the use of the JNI console interaction. -
isEchoEnabled
public boolean isEchoEnabled()从类复制的说明:Terminal
Returns false if character echoing is disabled.- 指定者:
isEchoEnabled
在类中Terminal
-
enableEcho
public void enableEcho()从类复制的说明:Terminal
Enable character echoing. This can be used to re-enable character if the ConsoleReader is no longer being used.- 指定者:
enableEcho
在类中Terminal
-
disableEcho
public void disableEcho()从类复制的说明:Terminal
Disable character echoing. This can be used to manually re-enable character if the ConsoleReader has been disabled.- 指定者:
disableEcho
在类中Terminal
-
getDefaultBindings
- 覆盖:
getDefaultBindings
在类中Terminal
-