程序包 jline
类 Terminal
java.lang.Object
jline.Terminal
- 所有已实现的接口:
ConsoleOperations
- 直接已知子类:
UnixTerminal
,UnsupportedTerminal
,WindowsTerminal
Representation of the input terminal for a platform. Handles
any initialization that the platform may need to perform
in order to allow the
ConsoleReader
to correctly handle
input.-
字段概要
从接口继承的字段 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
afterReadLine
(ConsoleReader reader, String prompt, Character mask) Invokes after the console reads a line with the prompt and mask.void
beforeReadLine
(ConsoleReader reader, String prompt, Character mask) Invokes before the console reads a line with the prompt and mask.abstract void
Disable character echoing.abstract void
Enable character echoing.abstract boolean
getEcho()
Returns true if the terminal will echo all characters type.static Terminal
abstract int
Returns the current height of the terminal (in lines)abstract int
Returns the current width of the terminal (in characters)abstract 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
Returns true if the current console supports ANSI codes.abstract boolean
Returns false if character echoing is disabled.abstract 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.static void
Reset the current terminal to null.static Terminal
Configure and return theTerminal
instance for the current platform.
-
构造器详细资料
-
Terminal
public Terminal()
-
-
方法详细资料
-
getTerminal
- 另请参阅:
-
resetTerminal
public static void resetTerminal()Reset the current terminal to null. -
setupTerminal
Configure and return the
Terminal
instance for the current platform. This will 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.This class will use the Terminal implementation specified in the jline.terminal system property, or, if it is unset, by detecting the operating system from the os.name system property and instantiating either the
WindowsTerminalTest
orUnixTerminal
.- 另请参阅:
-
isANSISupported
public boolean isANSISupported()Returns true if the current console supports ANSI codes. -
readCharacter
Read a single character from the input stream. This might enable a terminal implementation to better handle nuances of the console.- 抛出:
IOException
-
readVirtualKey
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.- 参数:
in
- the InputStream to read from- 返回:
- the virtual key (e.g.,
ConsoleOperations#VK_UP
) - 抛出:
IOException
-
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.- 抛出:
Exception
-
getTerminalWidth
public abstract int getTerminalWidth()Returns the current width of the terminal (in characters) -
getTerminalHeight
public abstract int getTerminalHeight()Returns the current height of the terminal (in lines) -
isSupported
public abstract boolean isSupported()Returns true if this terminal is capable of initializing the terminal to use jline. -
getEcho
public abstract boolean getEcho()Returns true if the terminal will echo all characters type. -
beforeReadLine
Invokes before the console reads a line with the prompt and mask. -
afterReadLine
Invokes after the console reads a line with the prompt and mask. -
isEchoEnabled
public abstract boolean isEchoEnabled()Returns false if character echoing is disabled. -
enableEcho
public abstract void enableEcho()Enable character echoing. This can be used to re-enable character if the ConsoleReader is no longer being used. -
disableEcho
public abstract void disableEcho()Disable character echoing. This can be used to manually re-enable character if the ConsoleReader has been disabled. -
getDefaultBindings
-