public class LineDisciplineTerminal extends AbstractTerminal
Terminal
interface represents the slave
side of a PTY, but implementations derived from this class
will handle both the slave and master side of things.
In order to correctly handle line discipline, the terminal
needs to read the input in advance in order to raise the
signals as fast as possible.
For example, when the user hits Ctrl+C, we can't wait until
the application consumes all the read events.
The same applies to echoing, when enabled, as the echoing
has to happen as soon as the user hit the keyboard, and not
only when the application running in the terminal processes
the input.Modifier and Type | Field and Description |
---|---|
protected org.graalvm.shadowed.org.jline.terminal.Attributes |
attributes
Console data
|
protected OutputStream |
masterOutput |
protected org.graalvm.shadowed.org.jline.terminal.Size |
size |
protected NonBlockingPumpInputStream |
slaveInput |
protected OutputStream |
slaveInputPipe |
protected OutputStream |
slaveOutput |
protected NonBlockingReader |
slaveReader |
protected PrintWriter |
slaveWriter |
Constructor and Description |
---|
LineDisciplineTerminal(String name,
String type,
OutputStream masterOutput,
Charset encoding) |
LineDisciplineTerminal(String name,
String type,
OutputStream masterOutput,
Charset encoding,
org.graalvm.shadowed.org.jline.terminal.Terminal.SignalHandler signalHandler) |
Modifier and Type | Method and Description |
---|---|
protected void |
doClose() |
protected boolean |
doProcessInputByte(int c) |
org.graalvm.shadowed.org.jline.terminal.Attributes |
getAttributes()
Returns the terminal attributes.
|
org.graalvm.shadowed.org.jline.terminal.Size |
getSize()
Retrieve the size of the visible window
|
InputStream |
input()
Retrieve the input stream for this terminal.
|
OutputStream |
output()
Retrieve the output stream for this terminal.
|
void |
processInputByte(int c)
Master input processing.
|
void |
processInputBytes(byte[] input) |
void |
processInputBytes(byte[] input,
int offset,
int length) |
protected void |
processIOException(IOException ioException) |
protected void |
processOutputByte(int c)
Master output processing.
|
void |
raise(org.graalvm.shadowed.org.jline.terminal.Terminal.Signal signal) |
NonBlockingReader |
reader()
Retrieve the
Reader for this terminal. |
void |
setAttributes(org.graalvm.shadowed.org.jline.terminal.Attributes attr)
Set the terminal attributes.
|
void |
setSize(org.graalvm.shadowed.org.jline.terminal.Size sz) |
PrintWriter |
writer()
Retrieve the
Writer for this terminal. |
canPauseResume, checkInterrupted, close, echo, echo, echoSignal, encoding, enterRawMode, flush, getBooleanCapability, getCursorPosition, getKind, getName, getNumericCapability, getPalette, getStatus, getStatus, getStringCapability, getType, handle, hasFocusSupport, hasMouseSupport, parseInfoCmp, pause, pause, paused, puts, readMouseEvent, readMouseEvent, resume, setOnClose, trackFocus, trackMouse
protected final OutputStream masterOutput
protected final OutputStream slaveInputPipe
protected final NonBlockingPumpInputStream slaveInput
protected final NonBlockingReader slaveReader
protected final PrintWriter slaveWriter
protected final OutputStream slaveOutput
protected final org.graalvm.shadowed.org.jline.terminal.Attributes attributes
protected final org.graalvm.shadowed.org.jline.terminal.Size size
public LineDisciplineTerminal(String name, String type, OutputStream masterOutput, Charset encoding) throws IOException
IOException
public LineDisciplineTerminal(String name, String type, OutputStream masterOutput, Charset encoding, org.graalvm.shadowed.org.jline.terminal.Terminal.SignalHandler signalHandler) throws IOException
IOException
public NonBlockingReader reader()
org.graalvm.shadowed.org.jline.terminal.Terminal
Reader
for this terminal.
This is the standard way to read input from this terminal.
The reader is non blocking.public PrintWriter writer()
org.graalvm.shadowed.org.jline.terminal.Terminal
Writer
for this terminal.
This is the standard way to write to this terminal.public InputStream input()
org.graalvm.shadowed.org.jline.terminal.Terminal
Terminal.reader()
instead.Terminal.reader()
public OutputStream output()
org.graalvm.shadowed.org.jline.terminal.Terminal
Terminal.writer()
instead.Terminal.writer()
public org.graalvm.shadowed.org.jline.terminal.Attributes getAttributes()
org.graalvm.shadowed.org.jline.terminal.Terminal
Terminal.setAttributes(Attributes)
.public void setAttributes(org.graalvm.shadowed.org.jline.terminal.Attributes attr)
org.graalvm.shadowed.org.jline.terminal.Terminal
attr
- the new attributespublic org.graalvm.shadowed.org.jline.terminal.Size getSize()
org.graalvm.shadowed.org.jline.terminal.Terminal
Terminal.getBufferSize()
public void setSize(org.graalvm.shadowed.org.jline.terminal.Size sz)
public void raise(org.graalvm.shadowed.org.jline.terminal.Terminal.Signal signal)
raise
in interface org.graalvm.shadowed.org.jline.terminal.Terminal
raise
in class AbstractTerminal
public void processInputByte(int c) throws IOException
c
- the input byteIOException
- if anything wrong happenspublic void processInputBytes(byte[] input) throws IOException
IOException
public void processInputBytes(byte[] input, int offset, int length) throws IOException
IOException
protected boolean doProcessInputByte(int c) throws IOException
IOException
protected void processOutputByte(int c) throws IOException
c
- the output byteIOException
- if anything wrong happensprotected void processIOException(IOException ioException)
protected void doClose() throws IOException
doClose
in class AbstractTerminal
IOException