org.python.core.Console Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jython-slim Show documentation
Show all versions of jython-slim Show documentation
Jython is an implementation of the high-level, dynamic, object-oriented
language Python written in 100% Pure Java, and seamlessly integrated with
the Java platform. It thus allows you to run Python on any Java platform.
// Copyright (c) 2013 Jython Developers
package org.python.core;
import java.io.IOException;
import java.nio.charset.Charset;
/**
* A class named in configuration as the value of python.console
must implement this
* interface, and provide a constructor with a single String
argument, to be acceptable
* during initialization of the interpreter. The argument to the constructor names the encoding in
* use on the console. Such a class may provide line editing and history recall to an interactive
* console. A default implementation (that does not provide any such facilities) is available as
* {@link PlainConsole}.
*
* @see org.python.core.RegistryKey#PYTHON_CONSOLE
*/
public interface Console {
/**
* Complete initialization and (optionally) install a stream object with line-editing as the
* replacement for System.in
.
*
* @throws IOException in case of failure related to i/o
*/
public void install() throws IOException;
/**
* Uninstall the Console (if possible). A Console that installs a replacement for
* System.in
should put back the original value.
*
* @throws UnsupportedOperationException if the Console cannot be uninstalled
*/
public void uninstall() throws UnsupportedOperationException;
/**
* 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 {@link #getEncodingCharset()}.
*
* @return name of the encoding in use.
*/
public String getEncoding();
/**
* Accessor for encoding to use for line input as a Charset
.
*
* @return Charset of the encoding in use.
*/
public Charset getEncodingCharset();
}