Class Readline
A typical implementation could look like:
try { Readline.load(ReadlineLibrary.GnuReadline); } catch (UnsatisfiedLinkError ignore_me) { System.err.println("couldn't load readline lib. Using simple stdin."); } Readline.initReadline("myapp"); Runtime.getRuntime() // if your version supports .addShutdownHook(new Thread() { // addShutdownHook (since 1.3) public void run() { Readline.cleanup(); } }); while (true) { try { line = Readline.readline("myprompt> "); if (line == null) System.out.println("no input"); else processLine(); } catch (EOFException e) { break; } catch (Exception e) { doSomething(); } } Readline.cleanup(); // see note above about addShutdownHook
- Version:
- $Revision$
- Author:
- $Author$
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.gnu.readline.ReadlineConstInt
Constant to access history_base usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access history_length usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access history_max_entries usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstString
Constant to access history_no_expand_chars usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access history_quotes_inhibit_expansion usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstString
Constant to access history_search_delimiter_chars usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstString
Constant to access history_word_delimiters usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_already_prompted usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_attempted_completion_over usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstString
Constant to access rl_basic_quote_characters usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstString
Constant to access rl_basic_word_break_characters usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_catch_signals usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_catch_sigwinch usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstString
Constant to access rl_completer_quote_characters usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstString
Constant to access rl_completer_word_break_characters usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_completion_append_character usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_completion_mark_symlink_dirs usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_completion_query_items usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_completion_suppress_append usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_completion_type usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_dispatching usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_done usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_editing_mode usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_end usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_erase_empty_line usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstString
Constant to access rl_executing_macro usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_explicit_arg usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_filename_completion_desired usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstString
Constant to access rl_filename_quote_characters usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_filename_quoting_desired usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_gnu_readline_p usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_ignore_completion_duplicates usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_inhibit_completion usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_insert_mode usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstString
Constant to access rl_library_version usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstString
Constant to access rl_line_buffer usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_mark usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_num_chars_to_read usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_numeric_arg usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_pending_input usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_point usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstString
Constant to access rl_prompt usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstString
Constant to access rl_readline_name usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_readline_state usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstInt
Constant to access rl_readline_version usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstString
Constant to access rl_special_prefixes usinggetVar()
orsetVar()
.static final org.gnu.readline.ReadlineConstString
Constant to access rl_terminal_name usinggetVar()
orsetVar()
. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addToHistory
(String line) Add a line to the in-memory history.static void
cleanup()
Reset the readline library and with it, the terminal.static void
Clear the history buffer.static ReadlineCompleter
Query current completer function.static String
Query current encoding of fallback BufferedReader.static void
getHistory
(Collection collection) Get the history buffer in a supplied Collection.static String
getHistoryLine
(int i) Get the specified entry from the history buffer.static int
Get the size, in elements (lines), of the history buffer.static String
Query the current line buffer.static boolean
Query behavior in case an unsupported method is called.static int
getVar
(org.gnu.readline.ReadlineConstInt c) Query integer readline-variable.static String
getVar
(org.gnu.readline.ReadlineConstString c) Query string readline-variable.static String
Query word break characters.static boolean
Return if we have a terminal.static void
initReadline
(String applicationName) Initialize the GNU-Readline library.static final void
load
(ReadlineLibrary lib) Load an implementing backing library.static boolean
parseAndBind
(String line) Parse argument string as if it had been read from `inputrc' file and perform key bindings and variable assignments found.static void
readHistoryFile
(String filename) Reads a history file into memorystatic void
readInitFile
(String filename) Read keybindings and variable assignments from a file.static String
Display a prompt on standard output and read a string from standard input.static String
Display a prompt on standard output and read a string from standard input.static void
Set your completer implementation.static void
setEncoding
(String encoding) Set current encoding of fallback BufferedReader.static void
setThrowExceptionOnUnsupportedMethod
(boolean flag) Configure behavior in case an unsupported method is called.static int
setVar
(org.gnu.readline.ReadlineConstInt c, int value) Set integer readline-variable.static String
Set string readline-variable.static void
setWordBreakCharacters
(String wordBreakCharacters) Set word break characters.static void
writeHistoryFile
(String filename) Writes a history file to disc
-
Field Details
-
RL_LIBRARY_VERSION
public static final org.gnu.readline.ReadlineConstString RL_LIBRARY_VERSIONConstant to access rl_library_version usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Editline
-
RL_READLINE_NAME
public static final org.gnu.readline.ReadlineConstString RL_READLINE_NAMEConstant to access rl_readline_name usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Editline
-
RL_PROMPT
public static final org.gnu.readline.ReadlineConstString RL_PROMPTConstant to access rl_prompt usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Getline
-
RL_LINE_BUFFER
public static final org.gnu.readline.ReadlineConstString RL_LINE_BUFFERConstant to access rl_line_buffer usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Editline
- Getline
-
RL_TERMINAL_NAME
public static final org.gnu.readline.ReadlineConstString RL_TERMINAL_NAMEConstant to access rl_terminal_name usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_EXECUTING_MACRO
public static final org.gnu.readline.ReadlineConstString RL_EXECUTING_MACROConstant to access rl_executing_macro usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_BASIC_WORD_BREAK_CHARACTERS
public static final org.gnu.readline.ReadlineConstString RL_BASIC_WORD_BREAK_CHARACTERSConstant to access rl_basic_word_break_characters usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Editline
-
RL_COMPLETER_WORD_BREAK_CHARACTERS
public static final org.gnu.readline.ReadlineConstString RL_COMPLETER_WORD_BREAK_CHARACTERSConstant to access rl_completer_word_break_characters usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Editline
-
RL_COMPLETER_QUOTE_CHARACTERS
public static final org.gnu.readline.ReadlineConstString RL_COMPLETER_QUOTE_CHARACTERSConstant to access rl_completer_quote_characters usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Editline
-
RL_BASIC_QUOTE_CHARACTERS
public static final org.gnu.readline.ReadlineConstString RL_BASIC_QUOTE_CHARACTERSConstant to access rl_basic_quote_characters usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_FILENAME_QUOTE_CHARACTERS
public static final org.gnu.readline.ReadlineConstString RL_FILENAME_QUOTE_CHARACTERSConstant to access rl_filename_quote_characters usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_SPECIAL_PREFIXES
public static final org.gnu.readline.ReadlineConstString RL_SPECIAL_PREFIXESConstant to access rl_special_prefixes usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Editline
-
HISTORY_WORD_DELIMITERS
public static final org.gnu.readline.ReadlineConstString HISTORY_WORD_DELIMITERSConstant to access history_word_delimiters usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
HISTORY_NO_EXPAND_CHARS
public static final org.gnu.readline.ReadlineConstString HISTORY_NO_EXPAND_CHARSConstant to access history_no_expand_chars usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
HISTORY_SEARCH_DELIMITERS
public static final org.gnu.readline.ReadlineConstString HISTORY_SEARCH_DELIMITERSConstant to access history_search_delimiter_chars usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_READLINE_VERSION
public static final org.gnu.readline.ReadlineConstInt RL_READLINE_VERSIONConstant to access rl_readline_version usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_GNU_READLINE_P
public static final org.gnu.readline.ReadlineConstInt RL_GNU_READLINE_PConstant to access rl_gnu_readline_p usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_READLINE_STATE
public static final org.gnu.readline.ReadlineConstInt RL_READLINE_STATEConstant to access rl_readline_state usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_EDITING_MODE
public static final org.gnu.readline.ReadlineConstInt RL_EDITING_MODEConstant to access rl_editing_mode usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_INSERT_MODE
public static final org.gnu.readline.ReadlineConstInt RL_INSERT_MODEConstant to access rl_insert_mode usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Getline
-
RL_POINT
public static final org.gnu.readline.ReadlineConstInt RL_POINTConstant to access rl_point usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Editline
- Getline
-
RL_END
public static final org.gnu.readline.ReadlineConstInt RL_ENDConstant to access rl_end usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Editline
- Getline
-
RL_MARK
public static final org.gnu.readline.ReadlineConstInt RL_MARKConstant to access rl_mark usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_DONE
public static final org.gnu.readline.ReadlineConstInt RL_DONEConstant to access rl_done usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_PENDING_INPUT
public static final org.gnu.readline.ReadlineConstInt RL_PENDING_INPUTConstant to access rl_pending_input usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_DISPATCHING
public static final org.gnu.readline.ReadlineConstInt RL_DISPATCHINGConstant to access rl_dispatching usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_EXPLICIT_ARG
public static final org.gnu.readline.ReadlineConstInt RL_EXPLICIT_ARGConstant to access rl_explicit_arg usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_NUMERIC_ARG
public static final org.gnu.readline.ReadlineConstInt RL_NUMERIC_ARGConstant to access rl_numeric_arg usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_ERASE_EMPTY_LINE
public static final org.gnu.readline.ReadlineConstInt RL_ERASE_EMPTY_LINEConstant to access rl_erase_empty_line usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_ALREADY_PROMPTED
public static final org.gnu.readline.ReadlineConstInt RL_ALREADY_PROMPTEDConstant to access rl_already_prompted usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_NUM_CHARS_TO_READ
public static final org.gnu.readline.ReadlineConstInt RL_NUM_CHARS_TO_READConstant to access rl_num_chars_to_read usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_CATCH_SIGNALS
public static final org.gnu.readline.ReadlineConstInt RL_CATCH_SIGNALSConstant to access rl_catch_signals usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_CATCH_SIGWINCH
public static final org.gnu.readline.ReadlineConstInt RL_CATCH_SIGWINCHConstant to access rl_catch_sigwinch usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_FILENAME_COMPLETION_DESIRED
public static final org.gnu.readline.ReadlineConstInt RL_FILENAME_COMPLETION_DESIREDConstant to access rl_filename_completion_desired usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_FILENAME_QUOTING_DESIRED
public static final org.gnu.readline.ReadlineConstInt RL_FILENAME_QUOTING_DESIREDConstant to access rl_filename_quoting_desired usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_ATTEMPTED_COMPLETION_OVER
public static final org.gnu.readline.ReadlineConstInt RL_ATTEMPTED_COMPLETION_OVERConstant to access rl_attempted_completion_over usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_COMPLETION_TYPE
public static final org.gnu.readline.ReadlineConstInt RL_COMPLETION_TYPEConstant to access rl_completion_type usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Editline
-
RL_COMPLETION_APPEND_CHARACTER
public static final org.gnu.readline.ReadlineConstInt RL_COMPLETION_APPEND_CHARACTERConstant to access rl_completion_append_character usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Editline
-
RL_COMPLETION_SUPPRESS_APPEND
public static final org.gnu.readline.ReadlineConstInt RL_COMPLETION_SUPPRESS_APPENDConstant to access rl_completion_suppress_append usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_COMPLETION_QUERY_ITEMS
public static final org.gnu.readline.ReadlineConstInt RL_COMPLETION_QUERY_ITEMSConstant to access rl_completion_query_items usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Editline
-
RL_COMPLETION_MARK_SYMLINK_DIRS
public static final org.gnu.readline.ReadlineConstInt RL_COMPLETION_MARK_SYMLINK_DIRSConstant to access rl_completion_mark_symlink_dirs usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_IGNORE_COMPLETION_DUPLICATES
public static final org.gnu.readline.ReadlineConstInt RL_IGNORE_COMPLETION_DUPLICATESConstant to access rl_ignore_completion_duplicates usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
RL_INHIBIT_COMPLETION
public static final org.gnu.readline.ReadlineConstInt RL_INHIBIT_COMPLETIONConstant to access rl_inhibit_completion usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Editline
-
HISTORY_BASE
public static final org.gnu.readline.ReadlineConstInt HISTORY_BASEConstant to access history_base usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Editline
-
HISTORY_LENGTH
public static final org.gnu.readline.ReadlineConstInt HISTORY_LENGTHConstant to access history_length usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
- Editline
-
HISTORY_MAX_ENTRIES
public static final org.gnu.readline.ReadlineConstInt HISTORY_MAX_ENTRIESConstant to access history_max_entries usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
HISTORY_QUOTES_EXPANSION
public static final org.gnu.readline.ReadlineConstInt HISTORY_QUOTES_EXPANSIONConstant to access history_quotes_inhibit_expansion usinggetVar()
orsetVar()
.Supporting implementations:
- GNU-Readline
-
-
Constructor Details
-
Readline
public Readline()
-
-
Method Details
-
load
Load an implementing backing library. This method might throw an UnsatisfiedLinkError in case the native libary is not found in the library path. If you want to have a portable program, just catch and ignore that error. JavaReadline will then just use the pure Java fallback solution.- Parameters:
lib
- An object (constant) of type ReadlineLibrary- Throws:
UnsatisfiedLinkError
- if the shared library could not be found. Add it to your LD_LIBRARY_PATH.- See Also:
-
initReadline
Initialize the GNU-Readline library. This will also set the application name, which can be used in the initialization files of Readline (usually /etc/inputrc and ~/.inputrc) to define application specific keys. See the file ReadlineTest.java int the test subdir of the distribution for an example.Supporting implementations:
- GNU-Readline
- Editline
- Getline
- Parameters:
applicationName
- Name of application in initialization file
-
readline
public static String readline(String prompt) throws EOFException, IOException, UnsupportedEncodingException Display a prompt on standard output and read a string from standard input. This method returns 'null', if there has been an empty input (user pressed just [RETURN]) and throws an EOFException on end-of-file (C-d). This versino of readline() automatically adds the line to the in-memory history; use the other version of readline() if you want explicit control over that feature.Supporting implementations:
- GNU-Readline
- Editline
- Getline
- PureJava
- Parameters:
prompt
- Prompt to display- Returns:
- The string the user entered or 'null' if there was no input.
- Throws:
EOFException
- on end-of-file, i.e. CTRL-d input.IOException
UnsupportedEncodingException
- See Also:
-
readline(String,boolean)
#addHistory()
-
readline
public static String readline(String prompt, boolean addToHist) throws EOFException, IOException, UnsupportedEncodingException Display a prompt on standard output and read a string from standard input. This method returns 'null', if there has been an empty input (user pressed just [RETURN]) and throws an EOFException on end-of-file (C-d).- Parameters:
prompt
- Prompt to displayaddToHist
- true to add the line to the history automatically; false to refrain from adding the line to the history. (You can manually add the line to the history by calling addHistory().)- Returns:
- The string the user entered or 'null' if there was no input.
- Throws:
EOFException
- on end-of-file, i.e. CTRL-d input.IOException
UnsupportedEncodingException
- See Also:
-
readline(String)
#addHistory()
-
addToHistory
Add a line to the in-memory history.Supporting implementations:
- GNU-Readline
- Editline
- Getline
- Parameters:
line
- The line to add to the history- Throws:
UnsupportOperationException
- if underlying library doesn't support a history
-
getHistory
Get the history buffer in a supplied Collection.Supporting implementations:
- GNU-Readline
- Editline
- Parameters:
collection
- where to store the history- Throws:
UnsupportOperationException
- if underlying library doesn't support a history
-
getHistorySize
public static int getHistorySize()Get the size, in elements (lines), of the history buffer.Supporting implementations:
- GNU-Readline
- Editline
- Returns:
- the number of lines in the history buffer
-
clearHistory
public static void clearHistory()Clear the history buffer.Supporting implementations:
- GNU-Readline
- Editline
-
getHistoryLine
Get the specified entry from the history buffer. History buffer entries are numbered from 0 through (getHistorySize() - 1), with the oldest entry at index 0.Supporting implementations:
- GNU-Readline
- Editline
- Parameters:
i
- the index of the entry to return- Returns:
- the line at the specified index in the history buffer
- Throws:
ArrayIndexOutOfBoundsException
- index out of range
-
readInitFile
Read keybindings and variable assignments from a file. This method is a wrapper to rl_read_init_file(char *filename). Throws IOException if something goes wrong.Supporting implementations:
- GNU-Readline
- Parameters:
filename
- Name of file to read bindings from- Throws:
IOException
-
parseAndBind
Parse argument string as if it had been read from `inputrc' file and perform key bindings and variable assignments found.Supporting implementations:
- GNU-Readline
- Parameters:
line
- Simulated line from inputrc file- Returns:
- boolean False in case of error
-
readHistoryFile
public static void readHistoryFile(String filename) throws EOFException, UnsupportedEncodingException Reads a history file into memorySupporting implementations:
- GNU-Readline
- Editline
- Parameters:
filename
- Name of history file to read- Throws:
EOFException
UnsupportedEncodingException
-
writeHistoryFile
public static void writeHistoryFile(String filename) throws EOFException, UnsupportedEncodingException Writes a history file to discSupporting implementations:
- GNU-Readline
- Editline
- Parameters:
filename
- Name of history file to write- Throws:
EOFException
UnsupportedEncodingException
-
setCompleter
Set your completer implementation. Setting this tonull
will result in the default behaviour of readline which is filename completion.Supporting implementations:
- GNU-Readline
- Editline
- Parameters:
rlc
- An object implementing the ReadlineCompleter interface
-
getCompleter
Query current completer function.- Returns:
- Current ReadlineCompleter object
-
cleanup
public static void cleanup()Reset the readline library and with it, the terminal.Supporting implementations:
- GNU-Readline
- Editline
-
hasTerminal
public static boolean hasTerminal()Return if we have a terminal. This requires, that any of the native libraries have been loaded yet (so call Readline.load(ReadlineLibrary)
()) first, otherwise this will always return true.Supporting implementations:
- GNU-Readline
- Editline
-
setWordBreakCharacters
public static void setWordBreakCharacters(String wordBreakCharacters) throws UnsupportedEncodingException Set word break characters.Supporting implementations:
- GNU-Readline
- Editline
- Parameters:
wordBreakCharacters
- A string of word break characters- Throws:
UnsupportedEncodingException
-
getWordBreakCharacters
Query word break characters.Supporting implementations:
- GNU-Readline
- Editline
-
getLineBuffer
Query the current line buffer. This returns the current content of the internal line buffer. You might need this in aReadlineCompleter
implementation to access the full text given so far.Supporting implementations:
- GNU-Readline
- Editline
-
setThrowExceptionOnUnsupportedMethod
public static void setThrowExceptionOnUnsupportedMethod(boolean flag) Configure behavior in case an unsupported method is called. If argument is true, unsupported methods throw an UnsupportedOperationException.- Parameters:
flag
- configuration flag
-
getThrowExceptionOnUnsupportedMethod
public static boolean getThrowExceptionOnUnsupportedMethod()Query behavior in case an unsupported method is called.- Returns:
- configuration flag
-
setEncoding
Set current encoding of fallback BufferedReader.- Parameters:
encoding
- encoding to use
-
getEncoding
Query current encoding of fallback BufferedReader.- Returns:
- current encoding
-
setVar
public static int setVar(org.gnu.readline.ReadlineConstInt c, int value) Set integer readline-variable.- Parameters:
c
- symbolic constant of readline-variablevalue
- new value of readline-variable- Returns:
- old value of readline-variable
-
getVar
public static int getVar(org.gnu.readline.ReadlineConstInt c) Query integer readline-variable.- Parameters:
c
- symbolic constant of readline-variable- Returns:
- value of variable
-
setVar
public static String setVar(org.gnu.readline.ReadlineConstString c, String value) throws UnsupportedEncodingException Set string readline-variable.- Parameters:
c
- symbolic constant of readline-variablevalue
- new value of readline-variable- Returns:
- old value of readline-variable
- Throws:
UnsupportedEncodingException
-
getVar
public static String getVar(org.gnu.readline.ReadlineConstString c) throws UnsupportedEncodingException Query string readline-variable.- Parameters:
c
- symbolic constant of readline-variable- Returns:
- value of variable
- Throws:
UnsupportedEncodingException
-