public class PlainConsole extends Object implements Console
python.console
, and
implementing interface Console
. PlainConsole
may be selected by the user
through that registry, and is the default console when the selected one fails to load. It will
also be installed by the Jython command-line application when in non-interactive mode.
Unlike some consoles, PlainConsole
does not install a replacement for
System.in
or System.out
, or use a native library. It prompts on
System.out
and reads from System.in
(wrapped with the console
encoding).
Modifier and Type | Field and Description |
---|---|
String |
encoding
Encoding to use for line input.
|
Charset |
encodingCharset
Encoding to use for line input as a
Charset . |
Constructor and Description |
---|
PlainConsole(String encoding)
Construct an instance of the console class specifying the character encoding.
|
Modifier and Type | Method and Description |
---|---|
String |
getEncoding()
Name of the encoding, normally supplied during initialisation, and used for line input.
|
Charset |
getEncodingCharset()
Accessor for encoding to use for line input as a
Charset . |
void |
install()
Complete initialization and (optionally) install a stream object with line-editing as the
replacement for
System.in . |
void |
uninstall()
A
PlainConsole may be uninstalled. |
public final String encoding
public final Charset encodingCharset
Charset
.public PlainConsole(String encoding) throws IllegalCharsetNameException, UnsupportedCharsetException
System.in
or
System.out
, and does not add any line-editing capability to what is standard for
your OS console.encoding
- name of a supported encoding or null
for
Charset.defaultCharset()
IllegalCharsetNameException
UnsupportedCharsetException
public void install()
Console
System.in
.public void uninstall() throws UnsupportedOperationException
PlainConsole
may be uninstalled. This method assumes any sub-class may not be
uninstalled. Sub-classes that permit themselves to be uninstalled must override (and
not call) this method.uninstall
in interface Console
UnsupportedOperationException
- unless this class is exactly PlainConsole
public String getEncoding()
Console
Console.getEncodingCharset()
.getEncoding
in interface Console
public Charset getEncodingCharset()
Console
Charset
.getEncodingCharset
in interface Console