public class ReadlineReader
extends java.io.Reader
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.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_PROMPT |
| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
public static final java.lang.String DEFAULT_PROMPT
public ReadlineReader(java.lang.String prompt,
ReadlineLibrary lib)
public ReadlineReader(ReadlineLibrary lib)
public ReadlineReader(java.io.File history,
ReadlineLibrary lib)
throws java.io.IOException
java.io.IOExceptionpublic ReadlineReader(java.lang.String prompt,
java.io.File history,
ReadlineLibrary lib)
throws java.io.IOException
java.io.IOExceptionpublic 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.Readerjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.Readerjava.io.IOExceptionpublic static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.ExceptionReleased under the LGPL, (c) Bernhard Bablok, Henner Zeller 1998-2002
Homepage: http://java-readline.sourceforge.net/