--- libreadline-java-0.8.0.1.orig/Makefile +++ libreadline-java-0.8.0.1/Makefile @@ -86,10 +86,10 @@ world : jar build-native jar: build-java - cd $(BUILDDIR) ; jar -cvmf ../$(MF_STUB) ../$(JAR) * + cd $(BUILDDIR) ; fastjar -cvf ../$(JAR) org $(JAR): - cd $(BUILDDIR) ; jar -cvmf ../$(MF_STUB) ../$(JAR) * + cd $(BUILDDIR) ; fastjar -cvf ../$(JAR) org build-java: $(BUILDDIR) cd src ; $(MAKE) JAVAC="$(JAVAC)" JC_FLAGS="$(JC_FLAGS)" java --- libreadline-java-0.8.0.1.orig/src/native/Makefile +++ libreadline-java-0.8.0.1/src/native/Makefile @@ -110,7 +110,7 @@ -c org_gnu_readline_Readline.c org_gnu_readline_Readline.h: $(BUILDDIR)/org/gnu/readline/Readline.class - javah -classpath $(BUILDDIR) -jni org.gnu.readline.Readline + gjavah -classpath $(BUILDDIR) -jni org.gnu.readline.Readline touch org_gnu_readline_Readline.h clean: --- libreadline-java-0.8.0.1.orig/src/native/org_gnu_readline_Readline.c +++ libreadline-java-0.8.0.1/src/native/org_gnu_readline_Readline.c @@ -70,6 +70,14 @@ static char* undefinedInternalString = NULL; static char undefinedInternalChar = '0'; +/* + * Some variables are available with editline but are not declared in + * the appropriate headers. + */ +#ifdef JavaEditline +extern int rl_inhibit_completion; +#endif + #ifdef JavaReadline static int* globalIntegerInternals[] = { &rl_readline_version, @@ -145,8 +153,8 @@ &undefinedInternalInt, /* &rl_readline_state, */ &undefinedInternalInt, /* &rl_editing_mode, */ &undefinedInternalInt, /* &rl_insert_mode, */ - &undefinedInternalInt, /* &rl_point, */ - &undefinedInternalInt, /* &rl_end, */ + &rl_point, + &rl_end, &undefinedInternalInt, /* &rl_mark, */ &undefinedInternalInt, /* &rl_done, */ &undefinedInternalInt, /* &rl_pending_input, */ @@ -161,34 +169,34 @@ &undefinedInternalInt, /* &rl_filename_completion_desired, */ &undefinedInternalInt, /* &rl_filename_quoting_desired, */ &undefinedInternalInt, /* &rl_attempted_completion_over, */ - &undefinedInternalInt, /* &rl_completion_type, */ - &undefinedInternalInt, /* &rl_completion_append_character, */ + &rl_completion_type, + &rl_completion_append_character, &undefinedInternalInt, /* &rl_completion_suppress_append, */ - &undefinedInternalInt, /* &rl_completion_query_items, */ + &rl_completion_query_items, &undefinedInternalInt, /* &rl_completion_mark_symlink_dirs, */ &undefinedInternalInt, /* &rl_ignore_completion_duplicates, */ - &undefinedInternalInt, /* &rl_inhibit_completion, */ + &rl_inhibit_completion, - &undefinedInternalInt, /* &history_base, */ - &undefinedInternalInt, /* &history_length, */ + &history_base, + &history_length, &undefinedInternalInt, /* &history_max_entries, */ &undefinedInternalInt, /* &history_quotes_inhibit_expansion, */ NULL }; static char** globalStringInternals[] = { - &undefinedInternalString, /* const &rl_library_version, */ - &undefinedInternalString, /* const &rl_readline_name, */ + /* const */ &rl_library_version, + /* const */ &rl_readline_name, &undefinedInternalString, /* &rl_prompt, */ - &undefinedInternalString, /* &rl_line_buffer, */ + &rl_line_buffer, &undefinedInternalString, /* const &rl_terminal_name, */ &undefinedInternalString, /* &rl_executing_macro, */ - &undefinedInternalString, /* const &rl_basic_word_break_characters, */ - &undefinedInternalString, /* const &rl_completer_word_break_characters, */ - &undefinedInternalString, /* const &rl_completer_quote_characters, */ + /* const */ &rl_basic_word_break_characters, + /* const */ &rl_completer_word_break_characters, + /* const */ &rl_completer_quote_characters, &undefinedInternalString, /* const &rl_basic_quote_characters, */ &undefinedInternalString, /* const &rl_filename_quote_characters, */ - &undefinedInternalString, /* const &rl_special_prefixes, */ + /* const */ &rl_special_prefixes, &undefinedInternalString, /* &history_word_delimiters, */ &undefinedInternalString, /* &history_no_expand_chars, */ @@ -814,14 +822,17 @@ /* save old value */ - oldValue = strdup(*(globalStringInternals[(int) jindex])); - if (!oldValue) { - jclass newExcCls; - newExcCls = (*env)->FindClass(env,"java/lang/OutOfMemoryError"); - if (newExcCls != NULL) - (*env)->ThrowNew(env,newExcCls,""); - return; - } + if (*(globalStringInternals[(int) jindex])) { + oldValue = strdup(*(globalStringInternals[(int) jindex])); + if (!oldValue) { + jclass newExcCls; + newExcCls = (*env)->FindClass(env,"java/lang/OutOfMemoryError"); + if (newExcCls != NULL) + (*env)->ThrowNew(env,newExcCls,""); + return; + } + } else + oldValue = NULL; /* read new value from argument */ @@ -847,9 +858,12 @@ /* return old value */ - ucs2utf(oldValue); - free(oldValue); - return (*env)->NewStringUTF(env,buffer); + if (oldValue) { + ucs2utf(oldValue); + free(oldValue); + return (*env)->NewStringUTF(env,buffer); + } else + return NULL; } /* -------------------------------------------------------------------------- */ --- libreadline-java-0.8.0.1.orig/src/test/ReadlineTest.java +++ libreadline-java-0.8.0.1/src/test/ReadlineTest.java @@ -114,7 +114,7 @@ String version = Readline.getVar(Readline.RL_LIBRARY_VERSION); System.out.println("Readline-Version: " + version); } catch (UnsupportedEncodingException enc) { - System.err.println("Could not query libarary version"); + System.err.println("Could not query library version"); System.exit(0); } --- libreadline-java-0.8.0.1.orig/src/org/gnu/readline/Readline.java +++ libreadline-java-0.8.0.1/src/org/gnu/readline/Readline.java @@ -79,13 +79,14 @@
Supporting implementations:
Supporting implementations:
Supporting implementations:
Supporting implementations:
Supporting implementations:
Supporting implementations:
Supporting implementations:
Supporting implementations:
Supporting implementations:
Supporting implementations:
Supporting implementations:
Supporting implementations:
Supporting implementations:
Supporting implementations:
Supporting implementations:
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+readline()
into a buffer.
+Reader
wrapper for the Readline classes.getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+getVar()
or setVar()
.
+
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
+org.gnu.* | +
+ +
org.gnu.readline.ReadlineReader | +||
+public static final java.lang.String |
+DEFAULT_PROMPT |
+"" |
+
+ +
+
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
+The Java-Readline Library, Version 0.8.0 | +
All Classes
+
+
+Packages
+ |
+
+ + + --- libreadline-java-0.8.0.1.orig/api-html/packages.html +++ libreadline-java-0.8.0.1/api-html/packages.html @@ -0,0 +1,32 @@ + + + +
+ +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
+ +++The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
+ +++Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:
+
+- Interfaces (italic)
- Classes
- Exceptions
- Errors
+ +++Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
+
+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.- Class inheritance diagram
- Direct Subclasses
- All Known Subinterfaces
- All Known Implementing Classes
- Class/interface declaration
- Class/interface description +
+
- Nested Class Summary
- Field Summary
- Constructor Summary
- Method Summary +
+
- Field Detail
- Constructor Detail
- Method Detail
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with+java.lang.Object
. The interfaces do not inherit fromjava.lang.Object
.+
+- When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
- When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
+The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.+
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.+
+
+
+
+This help file applies to API documentation generated using the standard doclet.
+
+
+
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
Readline
+ +ReadlineCompleter + +ReadlineLibrary + +ReadlineReader + +ReadlineTest + +TestCompleter + + |
+
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
+Packages | +|
org.gnu.readline | ++ |
test | ++ |
+
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
+This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
+
+Link toNon-frame version.
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
Readline
+ +ReadlineCompleter + +ReadlineLibrary + +ReadlineReader + +ReadlineTest + +TestCompleter + + |
+
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + | +
+Class Summary | +|
ReadlineTest | +ReadlineTest.java + + This class shows the usage of the readline wrapper. | +
TestCompleter | +This class is a sample custom completer. | +
+
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + | +
+Classes
+
+ +ReadlineTest + +TestCompleter |
+
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + | +|||||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--test.ReadlineTest ++
+ReadlineTest.java + + This class shows the usage of the readline wrapper. It will read lines + from standard input using the GNU-Readline library. You can use the + standard line editing keys. You can also define application specific + keys. Put this into your ~/.inputrc (or into whatever file $INPUTRC + points to) and see what happens if you press function keys F1 to F3: +
+$if ReadlineTest +"\e[11~": "linux is great" +"\e[12~": "jikes is cool" +"\e[13~": "javac is slow" +$endif ++ + If one argument is given to ReadlineTest, a private initialization file + is read. If a second argument is given, the appropriate library is + loaded. +
+ +
+
+Constructor Summary | +|
ReadlineTest()
+
++ |
+
+Method Summary | +|
+static void |
+main(java.lang.String[] args)
+
++ Main entry point. |
+
Methods inherited from class java.lang.Object | +
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
+Constructor Detail | +
+public ReadlineTest()+
+Method Detail | +
+public static void main(java.lang.String[] args)+
+
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + | +|||||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + | +|||||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--test.TestCompleter ++
+This class is a sample custom completer. If you press the TAB-key at + the readline prompt, you will see the two possible completions ("Linux" + and "Tux"). Once you have entered a "L" or a "T", you will only see + the respective single possible completion. In any other case, null is + returned to signal that no (more) completions are available. +
+ +
+
+Constructor Summary | +|
TestCompleter()
+
++ Default constructor. |
+
+Method Summary | +|
+ java.lang.String |
+completer(java.lang.String t,
+ int s)
+
++ Return possible completion. |
+
Methods inherited from class java.lang.Object | +
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
+Constructor Detail | +
+public TestCompleter()+
+
+Method Detail | +
+public java.lang.String completer(java.lang.String t, + int s)+
+
completer
in interface ReadlineCompleter
t
- start of completion text. This is the text since the last
+ word break character.s
- 0 or positive int. This state is zero on the first call
+ for a completion request and increments for each subsequent
+ call until the end of choices is reached.
+null
, if there
+ are no more choices.Readline.getWordBreakCharacters()
,
+TestCompleter
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + | +|||||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + | +|||||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.gnu.readline.ReadlineLibrary ++
+This class implements a typesafe enumeration of the backing libraries. +
+ +
+
+Field Summary | +|
+static ReadlineLibrary |
+Editline
+
++ Constant for Editline implementation. |
+
+static ReadlineLibrary |
+Getline
+
++ Constant for Getline implementation. |
+
+static ReadlineLibrary |
+GnuReadline
+
++ Constant for GNU-Readline implementation. |
+
+static ReadlineLibrary |
+PureJava
+
++ Constant for fallback, pure Java implementation. |
+
+Method Summary | +|
+static ReadlineLibrary |
+byName(java.lang.String name)
+
++ Return ReadlineLibrary-object with given name. |
+
+ java.lang.String |
+getName()
+
++ Query name of backing library. |
+
Methods inherited from class java.lang.Object | +
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
+Field Detail | +
+public static final ReadlineLibrary PureJava+
+
+public static final ReadlineLibrary GnuReadline+
+
+public static final ReadlineLibrary Editline+
+
+public static final ReadlineLibrary Getline+
+
+Method Detail | +
+public java.lang.String getName()+
+
+public static ReadlineLibrary byName(java.lang.String name)+
+
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + | +|||||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV + NEXT | ++ FRAMES + NO FRAMES + + + + | +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + | +
+Interface Summary | +|
ReadlineCompleter | +Callback interface that implements completion. | +
+ +
+Class Summary | +|
Readline | +This class implements basic functionality of the GNU-readline interface. | +
ReadlineLibrary | +This class implements a typesafe enumeration of the backing libraries. | +
ReadlineReader | +A Reader wrapper for the Readline classes. |
+
+
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV PACKAGE + NEXT PACKAGE | ++ FRAMES + NO FRAMES + + + + | +
+Interfaces
+
+ +ReadlineCompleter |
+
+Classes
+
+ +Readline + +ReadlineLibrary + +ReadlineReader |
+
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + | +|||||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+Callback interface that implements completion. You've to implement this + interface in order to provide completion in your application. The default + completion mode of the Readline library would otherwise be simple + filename completion. +
+ +
+
+Method Summary | +|
+ java.lang.String |
+completer(java.lang.String text,
+ int state)
+
++ A generator function for filename completion in the general case. |
+
+Method Detail | +
+public java.lang.String completer(java.lang.String text, + int state)+
The completer method is called with the current text to be
+ expanded (that is: the string of characters after the last
+ word break character
) and
+ an integer. The integer is zero to indicate, that the user just requested
+ completion (usually by pressing the TAB-key). The completeter method now
+ can return one possible choice or null to indicate that there is no
+ choice. If the completer returned a non-null value it is called back by
+ the readline library with increasing state
variable until
+ it returns null.
+
+
Depending on the state and the return value, the readline library + reacts differently. +
null
for state=0, then
+ the readline library will beep to indicate that there is no
+ known completion.null
for state=1, then there was exactly one
+ possible completion, that is immediately expanded on the command line.Example
+ Consider you have a sorted set (like a TreeSet) of commands:
+
+ SortedSet commandSet; // SortedSet<String> + ... + commandSet = new TreeSet(); + commandSet.add("copy"); + commandSet.add("copyme"); + commandSet.add("load"); + commandSet.add("list"); + ... +
+ private Iterator possibleValues; // iterator for subsequent calls. + + public String completer(String text, int state) { + if (state == 0) { + // first call to completer(): initialize our choices-iterator + possibleValues = commandSet.tailSet(text).iterator(); + } + if (possibleValues.hasNext()) { + String nextKey = (String) possibleValues.next(); + if (nextKey.startsWith(text)) + return nextKey; + } + return null; // we reached the last choice. + } +
+
text
- start of completion text. This is the text since the last
+ word break character.state
- 0 or positive int. This state is zero on the first call
+ for a completion request and increments for each subsequent
+ call until the end of choices is reached.
+null
, if there
+ are no more choices.Readline.getWordBreakCharacters()
,
+TestCompleter
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + | +|||||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + | +|||||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--org.gnu.readline.Readline ++
+This class implements basic functionality of the GNU-readline interface. It + uses native method calls if available, otherwise it defaults to normal + I/O using a BufferedReader. + +
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 + ++
+ +
+
+Field Summary | +|
+static org.gnu.readline.ReadlineConstInt |
+HISTORY_BASE
+
++ Constant to access history_base using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+HISTORY_LENGTH
+
++ Constant to access history_length using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+HISTORY_MAX_ENTRIES
+
++ Constant to access history_max_entries using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstString |
+HISTORY_NO_EXPAND_CHARS
+
++ Constant to access history_no_expand_chars using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+HISTORY_QUOTES_EXPANSION
+
++ Constant to access history_quotes_inhibit_expansion using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstString |
+HISTORY_SEARCH_DELIMITERS
+
++ Constant to access history_search_delimiter_chars using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstString |
+HISTORY_WORD_DELIMITERS
+
++ Constant to access history_word_delimiters using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_ALREADY_PROMPTED
+
++ Constant to access rl_already_prompted using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_ATTEMPTED_COMPLETION_OVER
+
++ Constant to access rl_attempted_completion_over using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstString |
+RL_BASIC_QUOTE_CHARACTERS
+
++ Constant to access rl_basic_quote_characters using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstString |
+RL_BASIC_WORD_BREAK_CHARACTERS
+
++ Constant to access rl_basic_word_break_characters using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_CATCH_SIGNALS
+
++ Constant to access rl_catch_signals using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_CATCH_SIGWINCH
+
++ Constant to access rl_catch_sigwinch using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstString |
+RL_COMPLETER_QUOTE_CHARACTERS
+
++ Constant to access rl_completer_quote_characters using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstString |
+RL_COMPLETER_WORD_BREAK_CHARACTERS
+
++ Constant to access rl_completer_word_break_characters using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_COMPLETION_APPEND_CHARACTER
+
++ Constant to access rl_completion_append_character using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_COMPLETION_MARK_SYMLINK_DIRS
+
++ Constant to access rl_completion_mark_symlink_dirs using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_COMPLETION_QUERY_ITEMS
+
++ Constant to access rl_completion_query_items using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_COMPLETION_SUPPRESS_APPEND
+
++ Constant to access rl_completion_suppress_append using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_COMPLETION_TYPE
+
++ Constant to access rl_completion_type using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_DISPATCHING
+
++ Constant to access rl_dispatching using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_DONE
+
++ Constant to access rl_done using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_EDITING_MODE
+
++ Constant to access rl_editing_mode using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_END
+
++ Constant to access rl_end using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_ERASE_EMPTY_LINE
+
++ Constant to access rl_erase_empty_line using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstString |
+RL_EXECUTING_MACRO
+
++ Constant to access rl_executing_macro using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_EXPLICIT_ARG
+
++ Constant to access rl_explicit_arg using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_FILENAME_COMPLETION_DESIRED
+
++ Constant to access rl_filename_completion_desired using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstString |
+RL_FILENAME_QUOTE_CHARACTERS
+
++ Constant to access rl_filename_quote_characters using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_FILENAME_QUOTING_DESIRED
+
++ Constant to access rl_filename_quoting_desired using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_GNU_READLINE_P
+
++ Constant to access rl_gnu_readline_p using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_IGNORE_COMPLETION_DUPLICATES
+
++ Constant to access rl_ignore_completion_duplicates using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_INHIBIT_COMPLETION
+
++ Constant to access rl_inhibit_completion using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_INSERT_MODE
+
++ Constant to access rl_insert_mode using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstString |
+RL_LIBRARY_VERSION
+
++ Constant to access rl_library_version using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstString |
+RL_LINE_BUFFER
+
++ Constant to access rl_line_buffer using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_MARK
+
++ Constant to access rl_mark using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_NUM_CHARS_TO_READ
+
++ Constant to access rl_num_chars_to_read using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_NUMERIC_ARG
+
++ Constant to access rl_numeric_arg using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_PENDING_INPUT
+
++ Constant to access rl_pending_input using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_POINT
+
++ Constant to access rl_point using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstString |
+RL_PROMPT
+
++ Constant to access rl_prompt using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstString |
+RL_READLINE_NAME
+
++ Constant to access rl_readline_name using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_READLINE_STATE
+
++ Constant to access rl_readline_state using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstInt |
+RL_READLINE_VERSION
+
++ Constant to access rl_readline_version using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstString |
+RL_SPECIAL_PREFIXES
+
++ Constant to access rl_special_prefixes using + getVar() or setVar() . |
+
+static org.gnu.readline.ReadlineConstString |
+RL_TERMINAL_NAME
+
++ Constant to access rl_terminal_name using + getVar() or setVar() . |
+
+Constructor Summary | +|
Readline()
+
++ |
+
+Method Summary | +|
+static void |
+addToHistory(java.lang.String line)
+
++ Add a line to the in-memory history. |
+
+static void |
+cleanup()
+
++ Reset the readline library and with it, the terminal. |
+
+static void |
+clearHistory()
+
++ Clear the history buffer. |
+
+static ReadlineCompleter |
+getCompleter()
+
++ Query current completer function. |
+
+static java.lang.String |
+getEncoding()
+
++ Query current encoding of fallback BufferedReader. |
+
+static void |
+getHistory(java.util.Collection collection)
+
++ Get the history buffer in a supplied Collection. |
+
+static java.lang.String |
+getHistoryLine(int i)
+
++ Get the specified entry from the history buffer. |
+
+static int |
+getHistorySize()
+
++ Get the size, in elements (lines), of the history buffer. |
+
+static java.lang.String |
+getLineBuffer()
+
++ Query the current line buffer. |
+
+static boolean |
+getThrowExceptionOnUnsupportedMethod()
+
++ Query behavior in case an unsupported method is called. |
+
+static int |
+getVar(org.gnu.readline.ReadlineConstInt c)
+
++ Query integer readline-variable. |
+
+static java.lang.String |
+getVar(org.gnu.readline.ReadlineConstString c)
+
++ Query string readline-variable. |
+
+static java.lang.String |
+getWordBreakCharacters()
+
++ Query word break characters. |
+
+static boolean |
+hasTerminal()
+
++ Return if we have a terminal. |
+
+static void |
+initReadline(java.lang.String applicationName)
+
++ Initialize the GNU-Readline library. |
+
+static void |
+load(ReadlineLibrary lib)
+
++ Load an implementing backing library. |
+
+static boolean |
+parseAndBind(java.lang.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(java.lang.String filename)
+
++ Reads a history file into memory + + |
+
+static void |
+readInitFile(java.lang.String filename)
+
++ Read keybindings and variable assignments from a file. |
+
+static java.lang.String |
+readline(java.lang.String prompt)
+
++ Display a prompt on standard output and read a string from standard + input. |
+
+static java.lang.String |
+readline(java.lang.String prompt,
+ boolean addToHist)
+
++ Display a prompt on standard output and read a string from + standard input. |
+
+static void |
+setCompleter(ReadlineCompleter rlc)
+
++ Set your completer implementation. |
+
+static void |
+setEncoding(java.lang.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 java.lang.String |
+setVar(org.gnu.readline.ReadlineConstString c,
+ java.lang.String value)
+
++ Set string readline-variable. |
+
+static void |
+setWordBreakCharacters(java.lang.String wordBreakCharacters)
+
++ Set word break characters. |
+
+static void |
+writeHistoryFile(java.lang.String filename)
+
++ Writes a history file to disc + + |
+
Methods inherited from class java.lang.Object | +
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
+Field Detail | +
+public static final org.gnu.readline.ReadlineConstString RL_LIBRARY_VERSION+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstString RL_READLINE_NAME+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstString RL_PROMPT+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstString RL_LINE_BUFFER+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstString RL_TERMINAL_NAME+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstString RL_EXECUTING_MACRO+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstString RL_BASIC_WORD_BREAK_CHARACTERS+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstString RL_COMPLETER_WORD_BREAK_CHARACTERS+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstString RL_COMPLETER_QUOTE_CHARACTERS+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstString RL_BASIC_QUOTE_CHARACTERS+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstString RL_FILENAME_QUOTE_CHARACTERS+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstString RL_SPECIAL_PREFIXES+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstString HISTORY_WORD_DELIMITERS+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstString HISTORY_NO_EXPAND_CHARS+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstString HISTORY_SEARCH_DELIMITERS+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_READLINE_VERSION+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_GNU_READLINE_P+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_READLINE_STATE+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_EDITING_MODE+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_INSERT_MODE+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_POINT+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_END+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_MARK+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_DONE+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_PENDING_INPUT+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_DISPATCHING+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_EXPLICIT_ARG+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_NUMERIC_ARG+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_ERASE_EMPTY_LINE+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_ALREADY_PROMPTED+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_NUM_CHARS_TO_READ+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_CATCH_SIGNALS+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_CATCH_SIGWINCH+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_FILENAME_COMPLETION_DESIRED+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_FILENAME_QUOTING_DESIRED+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_ATTEMPTED_COMPLETION_OVER+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_COMPLETION_TYPE+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_COMPLETION_APPEND_CHARACTER+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_COMPLETION_SUPPRESS_APPEND+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_COMPLETION_QUERY_ITEMS+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_COMPLETION_MARK_SYMLINK_DIRS+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_IGNORE_COMPLETION_DUPLICATES+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt RL_INHIBIT_COMPLETION+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt HISTORY_BASE+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt HISTORY_LENGTH+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt HISTORY_MAX_ENTRIES+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+public static final org.gnu.readline.ReadlineConstInt HISTORY_QUOTES_EXPANSION+
getVar()
or setVar()
.
+
+ Supporting implementations: +
+
+Constructor Detail | +
+public Readline()+
+Method Detail | +
+public static final void load(ReadlineLibrary lib) + throws java.lang.UnsatisfiedLinkError+
+
lib
- An object (constant) of type ReadlineLibrary
+java.lang.UnsatisfiedLinkError
- if the shared library could not be
+ found. Add it to your LD_LIBRARY_PATH.ReadlineLibrary
+public static void initReadline(java.lang.String applicationName)+
Supporting implementations: +
+
applicationName
- Name of application in initialization file+public static java.lang.String readline(java.lang.String prompt) + throws java.io.EOFException, + java.io.IOException, + java.io.UnsupportedEncodingException+
Supporting implementations: +
+
prompt
- Prompt to display
+java.io.EOFException
- on end-of-file, i.e. CTRL-d input.
+java.io.IOException
+java.io.UnsupportedEncodingException
readline(String,boolean)
,
+#addHistory()
+public static java.lang.String readline(java.lang.String prompt, + boolean addToHist) + throws java.io.EOFException, + java.io.IOException, + java.io.UnsupportedEncodingException+
+
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().)
+java.io.EOFException
- on end-of-file, i.e. CTRL-d input.
+java.io.IOException
+java.io.UnsupportedEncodingException
readline(String)
,
+#addHistory()
+public static void addToHistory(java.lang.String line)+
Supporting implementations: +
+
line
- The line to add to the history
+UnsupportOperationException
- if underlying library doesn't support
+ a history+public static void getHistory(java.util.Collection collection)+
Supporting implementations: +
+
collection
- where to store the history
+UnsupportOperationException
- if underlying library doesn't support
+ a history+public static int getHistorySize()+
Supporting implementations: +
+
+public static void clearHistory()+
Supporting implementations: +
+
+public static java.lang.String getHistoryLine(int i)+
Supporting implementations: +
+
i
- the index of the entry to return
+java.lang.ArrayIndexOutOfBoundsException
- index out of range+public static void readInitFile(java.lang.String filename) + throws java.io.IOException+
Supporting implementations: +
+
filename
- Name of file to read bindings from
+java.io.IOException
+public static boolean parseAndBind(java.lang.String line)+
Supporting implementations: +
+
line
- Simulated line from inputrc file
++public static void readHistoryFile(java.lang.String filename) + throws java.io.EOFException, + java.io.UnsupportedEncodingException+
Supporting implementations: +
+
filename
- Name of history file to read
+java.io.EOFException
+java.io.UnsupportedEncodingException
+public static void writeHistoryFile(java.lang.String filename) + throws java.io.EOFException, + java.io.UnsupportedEncodingException+
Supporting implementations: +
+
filename
- Name of history file to write
+java.io.EOFException
+java.io.UnsupportedEncodingException
+public static void setCompleter(ReadlineCompleter rlc)+
null
+ will result in the default behaviour of readline which is filename
+ completion.
+
+ Supporting implementations: +
+
rlc
- An object implementing the ReadlineCompleter interface+public static ReadlineCompleter getCompleter()+
+
+public static void cleanup()+
Supporting implementations: +
+
+public static boolean hasTerminal()+
load(ReadlineLibrary)
())
+ first, otherwise this will always return true.
+
+ Supporting implementations: +
+
+public static void setWordBreakCharacters(java.lang.String wordBreakCharacters) + throws java.io.UnsupportedEncodingException+
Supporting implementations: +
+
wordBreakCharacters
- A string of word break characters
+java.io.UnsupportedEncodingException
+public static java.lang.String getWordBreakCharacters()+
Supporting implementations: +
+
+public static java.lang.String getLineBuffer()+
ReadlineCompleter
implementation to access the full text
+ given so far.
+
+ Supporting implementations: +
+
+public static void setThrowExceptionOnUnsupportedMethod(boolean flag)+
+
flag
- configuration flag+public static boolean getThrowExceptionOnUnsupportedMethod()+
+
+public static void setEncoding(java.lang.String encoding)+
+
encoding
- encoding to use+public static java.lang.String getEncoding()+
+
+public static int setVar(org.gnu.readline.ReadlineConstInt c, + int value)+
+
c
- symbolic constant of readline-variablevalue
- new value of readline-variable
++public static int getVar(org.gnu.readline.ReadlineConstInt c)+
+
c
- symbolic constant of readline-variable
++public static java.lang.String setVar(org.gnu.readline.ReadlineConstString c, + java.lang.String value) + throws java.io.UnsupportedEncodingException+
+
c
- symbolic constant of readline-variablevalue
- new value of readline-variable
+java.io.UnsupportedEncodingException
+public static java.lang.String getVar(org.gnu.readline.ReadlineConstString c) + throws java.io.UnsupportedEncodingException+
+
c
- symbolic constant of readline-variable
+java.io.UnsupportedEncodingException
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + | +|||||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + | +|||||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +
+java.lang.Object + | + +--java.io.Reader + | + +--org.gnu.readline.ReadlineReader ++
+A Reader
wrapper for the Readline classes. This seems
+ to work fine in conjunction with such classes as BufferedReader,
+ but it hasn't been tested well enough to see if this will work well
+ in all cases.
+
+ This was implemented to make it easier to supplant Readline's
+ functionality [shrug] anywhere and everywhere, but specifically in
+ BeanShell.
+
+ +
+
+Field Summary | +|
+static java.lang.String |
+DEFAULT_PROMPT
+
++ |
+
Fields inherited from class java.io.Reader | +
lock |
+
+Constructor Summary | +|
ReadlineReader(java.io.File history,
+ ReadlineLibrary lib)
+
++ Constructs a ReadlineReader object with an associated history + file. |
+|
ReadlineReader(ReadlineLibrary lib)
+
++ Constructs a ReadlineReader object with the default prompt. |
+|
ReadlineReader(java.lang.String prompt,
+ java.io.File history,
+ ReadlineLibrary lib)
+
++ Constructs a ReadlineReader object with an associated history + file and prompt. |
+|
ReadlineReader(java.lang.String prompt,
+ ReadlineLibrary lib)
+
++ Constructs a ReadlineReader object with the given prompt. |
+
+Method Summary | +|
+ void |
+close()
+
++ Nullifies all buffers and writes history file if one was given + at construction time. |
+
+ java.lang.String |
+getPrompt()
+
++ Returns the current prompt. |
+
+static void |
+main(java.lang.String[] args)
+
++ |
+
+ int |
+read(char[] cbuf,
+ int off,
+ int len)
+
++ Reads what's given from readline() into a buffer. |
+
+ void |
+setPrompt(java.lang.String prompt)
+
++ Sets the prompt to the given value. |
+
Methods inherited from class java.io.Reader | +
mark, markSupported, read, read, ready, reset, skip |
+
Methods inherited from class java.lang.Object | +
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
+
+Field Detail | +
+public static final java.lang.String DEFAULT_PROMPT+
+Constructor Detail | +
+public ReadlineReader(java.lang.String prompt, + ReadlineLibrary lib)+
+
+public ReadlineReader(ReadlineLibrary lib)+
+
+public ReadlineReader(java.io.File history, + ReadlineLibrary lib) + throws java.io.IOException+
+
+public ReadlineReader(java.lang.String prompt, + java.io.File history, + ReadlineLibrary lib) + throws java.io.IOException+
+
+Method Detail | +
+public java.lang.String getPrompt()+
+
+public void setPrompt(java.lang.String prompt)+
+
+public int read(char[] cbuf, + int off, + int len) + throws java.io.IOException+
readline()
into a buffer.
+ When that buffer is emptied, readline()
is called
+ again to replenish that buffer. This seems to work fine in
+ conjunction with such classes as BufferedReader, but it hasn't
+ been tested well enough to see if this will work well in all
+ cases.
++
read
in class java.io.Reader
java.io.IOException
+public void close() + throws java.io.IOException+
+
close
in class java.io.Reader
java.io.IOException
+public static void main(java.lang.String[] args) + throws java.lang.Exception+
java.lang.Exception
+
+
|
++The Java-Readline Library, Version 0.8.0 + | +|||||||||
+ PREV CLASS + NEXT CLASS | ++ FRAMES + NO FRAMES + + + + | +|||||||||
+ SUMMARY: NESTED | FIELD | CONSTR | METHOD | ++DETAIL: FIELD | CONSTR | METHOD | +