org.python.util

## Class JLineConsole

- java.lang.Object
- - org.python.core.PlainConsole
  - - org.python.util.JLineConsole

All Implemented Interfaces:
  Console

    public class JLineConsole
    extends PlainConsole

This class uses JLine to provide readline like functionality to its console without requiring native readline support.

### Field Summary

Fields
`jline.console.ConsoleReader` `reader` Main interface to JLine.

### Fields inherited from class org.python.core.PlainConsole

`encoding, encodingCharset`

### Constructor Summary

Constructors
Constructor and Description
`JLineConsole(java.lang.String encoding)` Construct an instance of the console class specifying the character encoding.

### Method Summary

All Methods Instance Methods Concrete Methods
`jline.console.ConsoleReader` `getReader()`
`PyObject` `getStartupHook()`
`void` `install()` Complete initialization and (optionally) install a stream object with line-editing as the replacement for `System.in`.
`void` `setStartupHook(PyObject hook)` Sets the startup hook (called prior to each readline)

### Methods inherited from class org.python.core.PlainConsole

`getEncoding, getEncodingCharset, uninstall`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### reader

    public jline.console.ConsoleReader reader

Main interface to JLine.

### Constructor Detail

#### JLineConsole

    public JLineConsole(java.lang.String encoding)

Construct an instance of the console class specifying the character encoding. This encoding must be one supported by the JVM.

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

Parameters:
  `encoding` - name of a supported encoding or `null` for `Charset.defaultCharset()`

### Method Detail

#### install

    public void install()

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

This implementation overrides that by setting `System.in` to a `FilterInputStream` object that wraps JLine, and `System.out` with a layer that buffers incomplete lines for use as the console prompt.

Specified by:
  `install` in interface `Console`
Overrides:
  `install` in class `PlainConsole`

#### getReader

    public jline.console.ConsoleReader getReader()

Returns:
  the JLine console reader associated with this interpreter

#### getStartupHook

    public PyObject getStartupHook()

Returns:
  the startup hook (called prior to each readline)

#### setStartupHook

    public void setStartupHook(PyObject hook)

Sets the startup hook (called prior to each readline)