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.Terminal.MouseTracking, Terminal.Signal, Terminal.SignalHandler| Modifier and Type | Field and Description |
|---|---|
protected Attributes |
attributes
Console data
|
protected OutputStream |
masterOutput |
protected Size |
size |
protected InputStream |
slaveInput |
protected OutputStream |
slaveInputPipe |
protected OutputStream |
slaveOutput |
protected NonBlockingReader |
slaveReader |
protected PrintWriter |
slaveWriter |
| Constructor and Description |
|---|
LineDisciplineTerminal(String name,
String type,
OutputStream masterOutput,
String encoding) |
LineDisciplineTerminal(String name,
String type,
OutputStream masterOutput,
String encoding,
Terminal.SignalHandler signalHandler) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Attributes |
getAttributes() |
Size |
getSize() |
InputStream |
input() |
OutputStream |
output() |
void |
processInputByte(int c)
Master input processing.
|
protected void |
processOutputByte(int c)
Master output processing.
|
void |
raise(Terminal.Signal signal) |
NonBlockingReader |
reader() |
void |
setAttributes(Attributes attr) |
void |
setSize(Size sz) |
PrintWriter |
writer() |
echo, echo, echoSignal, enterRawMode, flush, getBooleanCapability, getCursorPosition, getKind, getName, getNumericCapability, getStringCapability, getType, handle, hasMouseSupport, parseInfoCmp, puts, readMouseEvent, readMouseEvent, trackMouseprotected final OutputStream masterOutput
protected final OutputStream slaveInputPipe
protected final InputStream slaveInput
protected final NonBlockingReader slaveReader
protected final PrintWriter slaveWriter
protected final OutputStream slaveOutput
protected final Attributes attributes
protected final Size size
public LineDisciplineTerminal(String name, String type, OutputStream masterOutput, String encoding) throws IOException
IOExceptionpublic LineDisciplineTerminal(String name, String type, OutputStream masterOutput, String encoding, Terminal.SignalHandler signalHandler) throws IOException
IOExceptionpublic NonBlockingReader reader()
public PrintWriter writer()
public InputStream input()
public OutputStream output()
public Attributes getAttributes()
public void setAttributes(Attributes attr)
public Size getSize()
public void setSize(Size sz)
public void raise(Terminal.Signal signal)
raise in interface Terminalraise in class AbstractTerminalpublic void processInputByte(int c)
throws IOException
c - the input byteIOExceptionprotected void processOutputByte(int c)
throws IOException
c - the output byteIOExceptionpublic void close()
throws IOException
IOExceptionCopyright © 2020. All rights reserved.