public class ReadlineConsole extends PlainConsole
Modifier and Type | Field and Description |
---|---|
static int |
MAX_PROMPT
The longest we expect a console prompt to be (in encoded bytes)
|
encoding, encodingCharset
Constructor and Description |
---|
ReadlineConsole(String encoding)
Construct an instance of the console class specifying the character encoding.
|
Modifier and Type | Method and Description |
---|---|
void |
install()
Complete initialization and (optionally) install a stream object with line-editing as the
replacement for
System.in . |
getEncoding, getEncodingCharset, uninstall
public static final int MAX_PROMPT
public ReadlineConsole(String encoding)
python.console.readlinelib
, or "Editline" by default.
Most of the initialisation is deferred to the install()
method so that any prior
console can uninstall itself before we change system console settings and
System.in
.
encoding
- name of a supported encoding or null
for
Charset.defaultCharset()
public void install()
System.in
.
This implementation overrides that by setting System.in
to a
FilterInputStream
object that wraps the configured console library, and wraps
System.out
in a stream that captures the prompt so the Readline
library may re-use it.
install
in interface Console
install
in class PlainConsole