public class ConsoleReader
extends java.lang.Object
implements java.io.Closeable
Terminal.init()
for convenience
methods for issuing platform-specific setup commands.Modifier and Type | Class and Description |
---|---|
private static class |
ConsoleReader.State
Possible states in which the current readline operation may be in.
|
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
appName |
private int |
autoprintThreshold
The number of tab-completion candidates above which a warning will be
prompted before showing all the candidates.
|
static char |
BACKSPACE |
private boolean |
bellEnabled |
private CursorBuffer |
buf |
private char |
charSearchChar
Last character searched for with a vi character search
|
private char |
charSearchFirstInvokeChar |
private char |
charSearchLastInvokeChar |
private java.lang.String |
commentBegin |
private java.util.List<Completer> |
completers |
private CompletionHandler |
completionHandler |
private ConsoleKeys |
consoleKeys |
private boolean |
copyPasteDetection
Set to true if the reader should attempt to detect copy-n-paste.
|
private boolean |
cursorOk |
static java.lang.String |
DEFAULT_INPUT_RC |
private java.lang.Character |
echoCharacter |
private java.lang.String |
encoding |
private static int |
ESCAPE |
private long |
escapeTimeout |
private boolean |
expandEvents |
private boolean |
handleLitteralNext |
private boolean |
handleUserInterrupt |
private History |
history |
private boolean |
historyEnabled |
private NonBlockingInputStream |
in |
static java.lang.String |
INPUT_RC |
private java.net.URL |
inputrcUrl |
static java.lang.String |
JLINE_COMPLETION_THRESHOLD |
static java.lang.String |
JLINE_ESC_TIMEOUT |
static java.lang.String |
JLINE_EXPAND_EVENTS |
static java.lang.String |
JLINE_INPUTRC |
static java.lang.String |
JLINE_NOBELL |
static char |
KEYBOARD_BELL |
private KillRing |
killRing |
private static java.lang.String |
LINE_SEPARATOR |
private java.lang.String |
macro |
private java.lang.Character |
mask |
private java.lang.Thread |
maskThread |
static char |
NULL_MASK |
private java.lang.StringBuilder |
opBuffer |
private CursorBuffer |
originalBuffer |
private java.io.Writer |
out |
private boolean |
paginationEnabled |
private int |
parenBlinkTimeout |
private java.lang.String |
previousSearchTerm |
private java.lang.String |
prompt |
private int |
promptLen |
private java.util.Stack<java.lang.Character> |
pushBackChar |
private boolean |
quotedInsert |
private static int |
READ_EXPIRED |
private java.io.Reader |
reader |
private boolean |
recording |
static char |
RESET_LINE |
private static java.util.ResourceBundle |
resources |
private int |
searchIndex |
private java.lang.StringBuffer |
searchTerm |
private boolean |
skipLF |
private ConsoleReader.State |
state |
static int |
TAB_WIDTH |
private Terminal2 |
terminal |
private java.lang.String |
yankBuffer
The vi yank buffer
|
Constructor and Description |
---|
ConsoleReader() |
ConsoleReader(java.io.InputStream in,
java.io.OutputStream out) |
ConsoleReader(java.io.InputStream in,
java.io.OutputStream out,
Terminal term) |
ConsoleReader(java.lang.String appName,
java.io.InputStream in,
java.io.OutputStream out,
Terminal term) |
ConsoleReader(java.lang.String appName,
java.io.InputStream in,
java.io.OutputStream out,
Terminal term,
java.lang.String encoding) |
Modifier and Type | Method and Description |
---|---|
private void |
abort() |
java.lang.String |
accept()
The equivalent of hitting <RET>.
|
boolean |
addCompleter(Completer completer)
Add the specified
Completer to the list of handlers for tab-completion. |
void |
addTriggeredAction(char c,
java.awt.event.ActionListener listener)
Adding a triggered Action allows to give another curse of action if a character passed the pre-processing.
|
private void |
afterReadLine() |
protected void |
back(int num)
Move the visual cursor backward without modifying the buffer cursor.
|
boolean |
backspace()
Issue a backspace.
|
private int |
backspace(int num)
Issue num backspaces.
|
private int |
backspaceAll() |
void |
beep()
Issue an audible keyboard bell.
|
private void |
beforeReadLine(java.lang.String prompt,
java.lang.Character mask) |
private boolean |
capitalizeWord() |
private void |
clearAhead(int num,
int pos)
Clear ahead the specified number of characters without moving the cursor.
|
private int |
clearEcho(int c)
Clear the echoed characters for the specified character code.
|
boolean |
clearScreen()
Clear the screen by issuing the ANSI "clear screen" code.
|
void |
close()
Shuts the console reader down.
|
protected boolean |
complete()
Use the completers to modify the buffer with the appropriate completions.
|
boolean |
delete()
Issue a delete.
|
private boolean |
deleteCurrentCharacter()
Delete the character at the current position and redraw the remainder of the buffer.
|
private boolean |
deleteNextWord() |
private boolean |
deletePreviousWord() |
private boolean |
downCaseWord() |
private void |
drawBuffer()
Redraw the rest of the buffer from the cursor onwards.
|
private void |
drawBuffer(int clear)
Redraw the rest of the buffer from the cursor onwards.
|
void |
drawLine()
Output put the prompt + the current buffer
|
protected java.lang.String |
expandEvents(java.lang.String str)
Expand event designator such as !!, !#, !3, etc...
|
protected void |
finalize()
Shuts down the ConsoleReader if the JVM attempts to clean it up.
|
(package private) java.lang.String |
finishBuffer()
Clear the buffer and add its contents to the history.
|
void |
flush()
Flush the console output stream.
|
private int |
fmtPrint(java.lang.CharSequence buff,
int cursorPos)
Output the specified characters to the output stream without manipulating the current buffer.
|
private int |
fmtPrint(java.lang.CharSequence buff,
int start,
int end) |
private int |
fmtPrint(java.lang.CharSequence buff,
int start,
int end,
int cursorPos) |
int |
getAutoprintThreshold() |
boolean |
getBellEnabled()
Get whether the console bell is enabled
|
private static int |
getBracketType(char ch)
Given a character determines what type of bracket it is (paren,
square, curly, or none).
|
java.lang.String |
getCommentBegin() |
java.util.Collection<Completer> |
getCompleters()
Returns an unmodifiable list of all the completers.
|
CompletionHandler |
getCompletionHandler() |
CursorBuffer |
getCursorBuffer() |
(package private) int |
getCursorPosition() |
java.lang.Character |
getEchoCharacter()
Returns the echo character.
|
boolean |
getExpandEvents() |
boolean |
getHandleLitteralNext()
Get wether literal next are handled by JLine.
|
boolean |
getHandleUserInterrupt()
Get whether user interrupt handling is enabled
|
History |
getHistory() |
java.io.InputStream |
getInput() |
static java.net.URL |
getInputRc()
Retrieve the URL for the inputrc configuration file in effect.
|
java.lang.String |
getKeyMap()
Returns the name of the current key mapping.
|
KeyMap |
getKeys() |
java.lang.String |
getLastBinding() |
java.io.Writer |
getOutput() |
java.lang.String |
getPrompt() |
Terminal |
getTerminal() |
private void |
insertClose(java.lang.String s) |
private java.lang.String |
insertComment(boolean isViMode) |
boolean |
isCopyPasteDetectionEnabled() |
private static boolean |
isDelimiter(char c)
Checks to see if the specified character is a delimiter.
|
boolean |
isHistoryEnabled()
Whether or not to add new commands to the history buffer.
|
private boolean |
isInViMoveOperationState() |
boolean |
isKeyMap(java.lang.String name) |
boolean |
isPaginationEnabled()
Whether to use pagination when the number of rows of candidates exceeds the height of the terminal.
|
private static boolean |
isWhitespace(char c)
Checks to see if a character is a whitespace character.
|
boolean |
killLine()
Kill the buffer ahead of the current cursor position.
|
private static java.lang.String |
lastLine(java.lang.String str)
Returns the text after the last '\n'.
|
int |
moveCursor(int num)
Move the cursor where characters.
|
private void |
moveCursorFromTo(int i0,
int i1) |
private boolean |
moveHistory(boolean next)
Move up or down the history tree.
|
private boolean |
moveHistory(boolean next,
int count)
Used in "vi" mode for argumented history move, to move a specific
number of history entries forward or back.
|
private void |
moveInternal(int where)
Move the cursor where characters, without checking the current buffer.
|
protected boolean |
moveToEnd() |
(package private) int |
nextTabStop(int pos) |
private boolean |
nextWord() |
boolean |
paste()
Paste the contents of the clipboard into the console buffer
|
private boolean |
previousWord() |
void |
print(java.lang.CharSequence s)
Output the specified string to the output stream (but not the buffer).
|
void |
printColumns(java.util.Collection<? extends java.lang.CharSequence> items)
Output the specified
Collection in proper columns. |
protected void |
printCompletionCandidates() |
void |
printForwardSearchStatus(java.lang.String searchTerm,
java.lang.String match) |
void |
println()
Output a platform-dependant newline.
|
void |
println(java.lang.CharSequence s) |
void |
printSearchStatus(java.lang.String searchTerm,
java.lang.String match) |
private void |
printSearchStatus(java.lang.String searchTerm,
java.lang.String match,
java.lang.String searchLabel) |
void |
putString(java.lang.CharSequence str)
Write out the specified string to the buffer and the output stream.
|
private void |
rawPrint(char c,
int num) |
(package private) void |
rawPrint(int c)
Raw output printing
|
(package private) void |
rawPrint(java.lang.String str) |
private void |
rawPrintln(java.lang.String s) |
java.lang.Object |
readBinding(KeyMap keys)
Read from the input stream and decode an operation from the key map.
|
int |
readCharacter()
Read a character from the console.
|
int |
readCharacter(boolean checkForAltKeyCombo)
Read a character from the console.
|
int |
readCharacter(boolean checkForAltKeyCombo,
char... allowed) |
int |
readCharacter(char... allowed) |
java.lang.String |
readLine()
Read the next line and return the contents of the buffer.
|
java.lang.String |
readLine(java.lang.Character mask)
Read the next line with the specified character mask.
|
java.lang.String |
readLine(java.lang.String prompt) |
java.lang.String |
readLine(java.lang.String prompt,
java.lang.Character mask)
Read a line from the in
InputStream , and return the line
(without any trailing newlines). |
java.lang.String |
readLine(java.lang.String prompt,
java.lang.Character mask,
java.lang.String buffer)
Read a line from the in
InputStream , and return the line
(without any trailing newlines). |
private java.lang.String |
readLineSimple()
Read a line for unsupported terminals.
|
void |
redrawLine()
Clear the line and redraw it.
|
boolean |
removeCompleter(Completer completer)
Remove the specified
Completer from the list of handlers for tab-completion. |
protected boolean |
resetLine()
Erase the current line.
|
void |
resetPromptLine(java.lang.String prompt,
java.lang.String buffer,
int cursorDest)
Erases the current line with the existing prompt, then redraws the line
with the provided prompt and buffer
|
void |
restoreLine(java.lang.String originalPrompt,
int cursorDest) |
int |
searchBackwards(java.lang.String searchTerm)
Search backwards in history from the current position.
|
int |
searchBackwards(java.lang.String searchTerm,
int startIndex)
Search backward in history from a given position.
|
int |
searchBackwards(java.lang.String searchTerm,
int startIndex,
boolean startsWith) |
int |
searchForwards(java.lang.String searchTerm)
Search forwards in history from the current position.
|
int |
searchForwards(java.lang.String searchTerm,
int startIndex)
Search forward in history from a given position.
|
int |
searchForwards(java.lang.String searchTerm,
int startIndex,
boolean startsWith) |
void |
setAutoprintThreshold(int threshold) |
void |
setBellEnabled(boolean enabled)
Set whether the console bell is enabled.
|
private void |
setBuffer(java.lang.CharSequence buffer) |
private void |
setBuffer(java.lang.String buffer)
Set the current buffer's content to the specified
String . |
private void |
setBufferKeepPos(java.lang.CharSequence buffer) |
private void |
setBufferKeepPos(java.lang.String buffer) |
void |
setCommentBegin(java.lang.String commentBegin)
Sets the string that will be used to start a comment when the
insert-comment key is struck.
|
void |
setCompletionHandler(CompletionHandler handler) |
void |
setCopyPasteDetection(boolean onoff)
Enables or disables copy and paste detection.
|
boolean |
setCursorPosition(int position)
Move the cursor position to the specified absolute index.
|
void |
setEchoCharacter(java.lang.Character c)
Set the echo character.
|
void |
setExpandEvents(boolean expand) |
void |
setHandleLitteralNext(boolean handleLitteralNext)
Set wether literal next are handled by JLine.
|
void |
setHandleUserInterrupt(boolean enabled)
Set whether user interrupts (ctrl-C) are handled by having JLine
throw
UserInterruptException from readLine() . |
void |
setHistory(History history) |
void |
setHistoryEnabled(boolean enabled)
Whether or not to add new commands to the history buffer.
|
(package private) void |
setInput(java.io.InputStream in) |
boolean |
setKeyMap(java.lang.String name)
Sets the current keymap by name.
|
void |
setPaginationEnabled(boolean enabled)
Whether to use pagination when the number of rows of candidates exceeds the height of the terminal.
|
void |
setParenBlinkTimeout(int timeout) |
void |
setPrompt(java.lang.String prompt) |
private void |
setupSigCont() |
void |
shutdown()
Deprecated.
Use
close() instead. |
private static char |
switchCase(char ch) |
private boolean |
tputs(java.lang.String cap,
java.lang.Object... params) |
private boolean |
transposeChars(int count)
Performs character transpose.
|
private boolean |
unixWordRubout(int count)
Deletes to the beginning of the word that the cursor is sitting on.
|
private boolean |
upCaseWord() |
private boolean |
viChangeCase(int count)
Switches the case of the current character from upper to lower
or lower to upper as necessary and advances the cursor one
position to the right.
|
private boolean |
viChangeChar(int count,
int c)
Implements the vi change character command (in move-mode "r"
followed by the character to change to).
|
private boolean |
viCharSearch(int count,
int invokeChar,
int ch)
Searches forward of the current position for a character and moves
the cursor onto it.
|
private boolean |
viDelete(int count)
Deletes the character you are sitting on and sucks the rest of
the line in from the right.
|
private Operation |
viDeleteChangeYankToRemap(Operation op)
This method is calling while doing a delete-to ("d"), change-to ("c"),
or yank-to ("y") and it filters out only those movement operations
that are allowable during those operations.
|
private boolean |
viDeleteTo(int startPos,
int endPos,
boolean isChange)
Performs the vi "delete-to" action, deleting characters between a given
span of the input line.
|
private boolean |
viEndWord(int count)
Implements a close facsimile of the vi end-of-word movement.
|
private boolean |
viMatch()
Implements vi style bracket matching ("%" command).
|
private boolean |
viNextWord(int count)
This is a close facsimile of the actual vi next word logic.
|
private boolean |
viPreviousWord(int count)
This is a close facsimile of the actual vi previous word logic.
|
private boolean |
viPut(int count)
Pasts the yank buffer to the right of the current cursor position
and moves the cursor to the end of the pasted region.
|
private boolean |
viRubout(int count)
Deletes the previous character from the cursor position
|
private int |
viSearch(char searchChar)
Implements vi search ("/" or "?").
|
private boolean |
viYankTo(int startPos,
int endPos)
Implement the "vi" yank-to operation.
|
(package private) int |
wcwidth(java.lang.CharSequence str,
int pos) |
(package private) int |
wcwidth(java.lang.CharSequence str,
int start,
int end,
int pos) |
(package private) int |
wcwidth(int ucs,
int pos) |
boolean |
yank() |
boolean |
yankPop() |
public static final java.lang.String JLINE_NOBELL
public static final java.lang.String JLINE_ESC_TIMEOUT
public static final java.lang.String JLINE_INPUTRC
public static final java.lang.String INPUT_RC
public static final java.lang.String DEFAULT_INPUT_RC
public static final java.lang.String JLINE_EXPAND_EVENTS
public static final char BACKSPACE
public static final char RESET_LINE
public static final char KEYBOARD_BELL
public static final char NULL_MASK
public static final int TAB_WIDTH
private static final java.util.ResourceBundle resources
private static final int ESCAPE
private static final int READ_EXPIRED
private final Terminal2 terminal
private final java.io.Writer out
private final CursorBuffer buf
private boolean cursorOk
private java.lang.String prompt
private int promptLen
private boolean expandEvents
private boolean bellEnabled
private boolean handleUserInterrupt
private boolean handleLitteralNext
private java.lang.Character mask
private java.lang.Character echoCharacter
private CursorBuffer originalBuffer
private java.lang.StringBuffer searchTerm
private java.lang.String previousSearchTerm
private int searchIndex
private int parenBlinkTimeout
private final java.lang.StringBuilder opBuffer
private final java.util.Stack<java.lang.Character> pushBackChar
private NonBlockingInputStream in
private long escapeTimeout
private java.io.Reader reader
private char charSearchChar
private char charSearchLastInvokeChar
private char charSearchFirstInvokeChar
private java.lang.String yankBuffer
private KillRing killRing
private java.lang.String encoding
private boolean quotedInsert
private boolean recording
private java.lang.String macro
private java.lang.String appName
private java.net.URL inputrcUrl
private ConsoleKeys consoleKeys
private java.lang.String commentBegin
private boolean skipLF
private boolean copyPasteDetection
private ConsoleReader.State state
public static final java.lang.String JLINE_COMPLETION_THRESHOLD
private final java.util.List<Completer> completers
private CompletionHandler completionHandler
private int autoprintThreshold
private boolean paginationEnabled
private History history
private boolean historyEnabled
private static final java.lang.String LINE_SEPARATOR
private java.lang.Thread maskThread
public ConsoleReader() throws java.io.IOException
java.io.IOException
public ConsoleReader(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public ConsoleReader(java.io.InputStream in, java.io.OutputStream out, Terminal term) throws java.io.IOException
java.io.IOException
public ConsoleReader(@Nullable java.lang.String appName, java.io.InputStream in, java.io.OutputStream out, @Nullable Terminal term) throws java.io.IOException
java.io.IOException
private void setupSigCont()
public static java.net.URL getInputRc() throws java.io.IOException
java.io.IOException
public KeyMap getKeys()
void setInput(java.io.InputStream in) throws java.io.IOException
java.io.IOException
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
@Deprecated public void shutdown()
close()
instead.close()
.protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public java.io.InputStream getInput()
public java.io.Writer getOutput()
public Terminal getTerminal()
public CursorBuffer getCursorBuffer()
public void setExpandEvents(boolean expand)
public boolean getExpandEvents()
public void setCopyPasteDetection(boolean onoff)
onoff
- true if detection is enabledpublic boolean isCopyPasteDetectionEnabled()
public void setBellEnabled(boolean enabled)
enabled
- true if enabled; false otherwisepublic boolean getBellEnabled()
public void setHandleUserInterrupt(boolean enabled)
UserInterruptException
from readLine()
.
Otherwise, the JVM will handle SIGINT
as normal, which
usually causes it to exit. The default is false
.public boolean getHandleUserInterrupt()
public void setHandleLitteralNext(boolean handleLitteralNext)
public boolean getHandleLitteralNext()
public void setCommentBegin(java.lang.String commentBegin)
commentBegin
- The begin comment string.public java.lang.String getCommentBegin()
public void setPrompt(java.lang.String prompt)
public java.lang.String getPrompt()
public void setEchoCharacter(java.lang.Character c)
myConsoleReader.setEchoCharacter(new Character('*'));Setting the character to
null
will restore normal character echoing.
Setting the character to Character.valueOf(0)
will cause nothing to be echoed.c
- the character to echo to the console in place of the typed character.public java.lang.Character getEchoCharacter()
protected final boolean resetLine() throws java.io.IOException
java.io.IOException
int wcwidth(java.lang.CharSequence str, int pos)
int wcwidth(java.lang.CharSequence str, int start, int end, int pos)
int wcwidth(int ucs, int pos)
int nextTabStop(int pos)
int getCursorPosition()
private static java.lang.String lastLine(java.lang.String str)
public boolean setCursorPosition(int position) throws java.io.IOException
java.io.IOException
private void setBuffer(java.lang.String buffer) throws java.io.IOException
String
. The
visual console will be modified to show the current buffer.buffer
- the new contents of the buffer.java.io.IOException
private void setBuffer(java.lang.CharSequence buffer) throws java.io.IOException
java.io.IOException
private void setBufferKeepPos(java.lang.String buffer) throws java.io.IOException
java.io.IOException
private void setBufferKeepPos(java.lang.CharSequence buffer) throws java.io.IOException
java.io.IOException
public void drawLine() throws java.io.IOException
java.io.IOException
public void redrawLine() throws java.io.IOException
java.io.IOException
final java.lang.String finishBuffer() throws java.io.IOException
java.io.IOException
protected java.lang.String expandEvents(java.lang.String str) throws java.io.IOException
java.io.IOException
public void putString(java.lang.CharSequence str) throws java.io.IOException
java.io.IOException
private void drawBuffer(int clear) throws java.io.IOException
clear
- the number of characters to clear after the end of the bufferjava.io.IOException
private void drawBuffer() throws java.io.IOException
java.io.IOException
private void clearAhead(int num, int pos) throws java.io.IOException
num
- the number of characters to clearpos
- the current screen cursor positionjava.io.IOException
protected void back(int num) throws java.io.IOException
java.io.IOException
public void flush() throws java.io.IOException
java.io.IOException
private int backspaceAll() throws java.io.IOException
java.io.IOException
private int backspace(int num) throws java.io.IOException
java.io.IOException
public boolean backspace() throws java.io.IOException
java.io.IOException
protected boolean moveToEnd() throws java.io.IOException
java.io.IOException
private boolean deleteCurrentCharacter() throws java.io.IOException
java.io.IOException
private Operation viDeleteChangeYankToRemap(Operation op)
op
- The incoming operation to remapprivate boolean viRubout(int count) throws java.io.IOException
count
- number of times to do it.java.io.IOException
private boolean viDelete(int count) throws java.io.IOException
count
- Number of times to perform the operation.java.io.IOException
private boolean viChangeCase(int count) throws java.io.IOException
count
- The number of times to repeatjava.io.IOException
private boolean viChangeChar(int count, int c) throws java.io.IOException
count
- Number of times to perform the actionc
- The character to change tojava.io.IOException
private boolean viPreviousWord(int count) throws java.io.IOException
count
- number of iterationsjava.io.IOException
private boolean viDeleteTo(int startPos, int endPos, boolean isChange) throws java.io.IOException
startPos
- The start positionendPos
- The end position.isChange
- If true, then the delete is part of a change operationg
(e.g. "c$" is change-to-end-of line, so we first must delete to end
of line to start the changejava.io.IOException
private boolean viYankTo(int startPos, int endPos) throws java.io.IOException
startPos
- The starting position from which to yankendPos
- The ending position to which to yankjava.io.IOException
private boolean viPut(int count) throws java.io.IOException
count
- Number of times to perform the operation.java.io.IOException
private boolean viCharSearch(int count, int invokeChar, int ch) throws java.io.IOException
count
- Number of times to repeat the process.ch
- The character to search forjava.io.IOException
private static char switchCase(char ch)
private final boolean isInViMoveOperationState()
private boolean viNextWord(int count) throws java.io.IOException
count
- number of iterationsjava.io.IOException
private boolean viEndWord(int count) throws java.io.IOException
count
- Number of times to repeat the actionjava.io.IOException
private boolean previousWord() throws java.io.IOException
java.io.IOException
private boolean nextWord() throws java.io.IOException
java.io.IOException
private boolean unixWordRubout(int count) throws java.io.IOException
count
- Number of times to perform the operationjava.io.IOException
private java.lang.String insertComment(boolean isViMode) throws java.io.IOException
java.io.IOException
private int viSearch(char searchChar) throws java.io.IOException
java.io.IOException
public void setParenBlinkTimeout(int timeout)
private void insertClose(java.lang.String s) throws java.io.IOException
java.io.IOException
private boolean viMatch() throws java.io.IOException
java.io.IOException
private static int getBracketType(char ch)
ch
- The character to checkprivate boolean deletePreviousWord() throws java.io.IOException
java.io.IOException
private boolean deleteNextWord() throws java.io.IOException
java.io.IOException
private boolean capitalizeWord() throws java.io.IOException
java.io.IOException
private boolean upCaseWord() throws java.io.IOException
java.io.IOException
private boolean downCaseWord() throws java.io.IOException
java.io.IOException
private boolean transposeChars(int count) throws java.io.IOException
count
- The number of times to perform the transposejava.io.IOException
public boolean isKeyMap(java.lang.String name)
public java.lang.String accept() throws java.io.IOException
java.io.IOException
private void abort() throws java.io.IOException
java.io.IOException
public int moveCursor(int num) throws java.io.IOException
num
- If less than 0, move abs(where) to the left, otherwise move where to the right.java.io.IOException
private void moveInternal(int where) throws java.io.IOException
where
- the number of characters to move to the right or left.java.io.IOException
private void moveCursorFromTo(int i0, int i1) throws java.io.IOException
java.io.IOException
public int readCharacter() throws java.io.IOException
java.io.IOException
public int readCharacter(boolean checkForAltKeyCombo) throws java.io.IOException
java.io.IOException
private int clearEcho(int c) throws java.io.IOException
java.io.IOException
public int readCharacter(char... allowed) throws java.io.IOException
java.io.IOException
public int readCharacter(boolean checkForAltKeyCombo, char... allowed) throws java.io.IOException
java.io.IOException
public java.lang.Object readBinding(KeyMap keys) throws java.io.IOException
keys
- the KeyMap to use for decoding the input streamnull
if the end of
stream has been reachedjava.io.IOException
public java.lang.String getLastBinding()
public java.lang.String readLine() throws java.io.IOException
java.io.IOException
public java.lang.String readLine(java.lang.Character mask) throws java.io.IOException
java.io.IOException
public java.lang.String readLine(java.lang.String prompt) throws java.io.IOException
java.io.IOException
public java.lang.String readLine(java.lang.String prompt, java.lang.Character mask) throws java.io.IOException
InputStream
, and return the line
(without any trailing newlines).prompt
- The prompt to issue to the console, may be null.java.io.IOException
public boolean setKeyMap(java.lang.String name)
name
- The name of the keymap to switch topublic java.lang.String getKeyMap()
setKeyMap(String)
.public java.lang.String readLine(java.lang.String prompt, java.lang.Character mask, java.lang.String buffer) throws java.io.IOException
InputStream
, and return the line
(without any trailing newlines).prompt
- The prompt to issue to the console, may be null.java.io.IOException
private java.lang.String readLineSimple() throws java.io.IOException
java.io.IOException
public boolean addCompleter(Completer completer)
Completer
to the list of handlers for tab-completion.completer
- the Completer
to addpublic boolean removeCompleter(Completer completer)
Completer
from the list of handlers for tab-completion.completer
- The Completer
to removepublic java.util.Collection<Completer> getCompleters()
public void setCompletionHandler(CompletionHandler handler)
public CompletionHandler getCompletionHandler()
protected boolean complete() throws java.io.IOException
java.io.IOException
protected void printCompletionCandidates() throws java.io.IOException
java.io.IOException
public void setAutoprintThreshold(int threshold)
threshold
- the number of candidates to print without issuing a warning.public int getAutoprintThreshold()
public void setPaginationEnabled(boolean enabled)
public boolean isPaginationEnabled()
public void setHistory(History history)
public History getHistory()
public void setHistoryEnabled(boolean enabled)
public boolean isHistoryEnabled()
private boolean moveHistory(boolean next, int count) throws java.io.IOException
next
- If true, move forwardcount
- The number of entries to movejava.io.IOException
private boolean moveHistory(boolean next) throws java.io.IOException
java.io.IOException
private int fmtPrint(java.lang.CharSequence buff, int cursorPos) throws java.io.IOException
java.io.IOException
private int fmtPrint(java.lang.CharSequence buff, int start, int end) throws java.io.IOException
java.io.IOException
private int fmtPrint(java.lang.CharSequence buff, int start, int end, int cursorPos) throws java.io.IOException
java.io.IOException
public void print(java.lang.CharSequence s) throws java.io.IOException
java.io.IOException
public void println(java.lang.CharSequence s) throws java.io.IOException
java.io.IOException
public void println() throws java.io.IOException
java.io.IOException
final void rawPrint(int c) throws java.io.IOException
java.io.IOException
final void rawPrint(java.lang.String str) throws java.io.IOException
java.io.IOException
private void rawPrint(char c, int num) throws java.io.IOException
java.io.IOException
private void rawPrintln(java.lang.String s) throws java.io.IOException
java.io.IOException
public boolean delete() throws java.io.IOException
java.io.IOException
public boolean killLine() throws java.io.IOException
java.io.IOException
public boolean yank() throws java.io.IOException
java.io.IOException
public boolean yankPop() throws java.io.IOException
java.io.IOException
public boolean clearScreen() throws java.io.IOException
java.io.IOException
public void beep() throws java.io.IOException
java.io.IOException
public boolean paste() throws java.io.IOException
java.io.IOException
public void addTriggeredAction(char c, java.awt.event.ActionListener listener)
public void printColumns(java.util.Collection<? extends java.lang.CharSequence> items) throws java.io.IOException
Collection
in proper columns.java.io.IOException
private void beforeReadLine(java.lang.String prompt, java.lang.Character mask)
private void afterReadLine()
public void resetPromptLine(java.lang.String prompt, java.lang.String buffer, int cursorDest) throws java.io.IOException
prompt
- the new promptbuffer
- the buffer to be drawncursorDest
- where you want the cursor set when the line has been drawn.
-1 for end of line.java.io.IOException
public void printSearchStatus(java.lang.String searchTerm, java.lang.String match) throws java.io.IOException
java.io.IOException
public void printForwardSearchStatus(java.lang.String searchTerm, java.lang.String match) throws java.io.IOException
java.io.IOException
private void printSearchStatus(java.lang.String searchTerm, java.lang.String match, java.lang.String searchLabel) throws java.io.IOException
java.io.IOException
public void restoreLine(java.lang.String originalPrompt, int cursorDest) throws java.io.IOException
java.io.IOException
public int searchBackwards(java.lang.String searchTerm, int startIndex)
searchTerm
- substring to search for.startIndex
- the index from which on to searchpublic int searchBackwards(java.lang.String searchTerm)
searchTerm
- substring to search for.public int searchBackwards(java.lang.String searchTerm, int startIndex, boolean startsWith)
public int searchForwards(java.lang.String searchTerm, int startIndex)
searchTerm
- substring to search for.startIndex
- the index from which on to searchpublic int searchForwards(java.lang.String searchTerm)
searchTerm
- substring to search for.public int searchForwards(java.lang.String searchTerm, int startIndex, boolean startsWith)
private static boolean isDelimiter(char c)
c
- The character to testprivate static boolean isWhitespace(char c)
Character.isWhitespace(char)
, however
eventually it should be hooked up so that the definition of whitespace
can be configured, as readline does.c
- The character to checkprivate boolean tputs(java.lang.String cap, java.lang.Object... params) throws java.io.IOException
java.io.IOException