Top Description Fields Constructors Methods
org.python.core

public Class PlainConsole

extends Object
implements Console
Class Inheritance
All Implemented Interfaces
org.python.core.Console
Known Direct Subclasses
org.python.util.JLineConsole
Imports
java.nio.charset.Charset, .IllegalCharsetNameException, .UnsupportedCharsetException

A base class for classes that can install a console wrapper for a specific console-handling library. The Jython command-line application, when it detects that the console is an interactive session, chooses and installs a class named in registry item 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).

See Also
org.python.core.RegistryKey#PYTHON_CONSOLE

Field Summary

Modifier and TypeField and Description
public final String
encoding

Encoding to use for line input.

public final Charset
encodingCharset

Encoding to use for line input as a Charset.

Constructor Summary

AccessConstructor and Description
public
PlainConsole(String
name of a supported encoding or null for Charset.defaultCharset()
encoding
)

Construct an instance of the console class specifying the character encoding.

Method Summary

Modifier and TypeMethod and Description
public String
getEncoding()

Implements org.python.core.Console.getEncoding.

Name of the encoding, normally supplied during initialisation, and used for line input.

public Charset
getEncodingCharset()

Implements org.python.core.Console.getEncodingCharset.

Accessor for encoding to use for line input as a Charset.

public void
install()

Implements org.python.core.Console.install.

Complete initialization and (optionally) install a stream object with line-editing as the replacement for System.in.

public void
uninstall()

Implements org.python.core.Console.uninstall.

A PlainConsole may be uninstalled.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

encodingback to summary
public final String encoding

Encoding to use for line input.

encodingCharsetback to summary
public final Charset encodingCharset

Encoding to use for line input as a Charset.

Constructor Detail

PlainConsoleback to summary
public PlainConsole(String encoding) throws IllegalCharsetNameException, UnsupportedCharsetException

Construct an instance of the console class specifying the character encoding. This encoding must be one supported by the JVM. The PlainConsole does not replace System.in or System.out, and does not add any line-editing capability to what is standard for your OS console.

Parameters
encoding:String

name of a supported encoding or null for Charset.defaultCharset()

Method Detail

getEncodingback to summary
public String getEncoding()

Implements org.python.core.Console.getEncoding.

Doc from org.python.core.Console.getEncoding.

Name of the encoding, normally supplied during initialisation, and used for line input. This may not be the cononoical name of the codec returned by getEncodingCharset().

Returns:String

name of the encoding in use.

Annotations
@Override

getEncodingCharsetback to summary
public Charset getEncodingCharset()

Implements org.python.core.Console.getEncodingCharset.

Doc from org.python.core.Console.getEncodingCharset.

Accessor for encoding to use for line input as a Charset.

Returns:Charset

Charset of the encoding in use.

Annotations
@Override

installback to summary
public void install()

Implements org.python.core.Console.install.

Doc from org.python.core.Console.install.

Complete initialization and (optionally) install a stream object with line-editing as the replacement for System.in.

Annotations
@Override
uninstallback to summary
public void uninstall() throws UnsupportedOperationException

Implements org.python.core.Console.uninstall.

A 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.

Annotations
@Override
Exceptions
UnsupportedOperationException:
unless this class is exactly PlainConsole