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 NonBlockingPumpInputStream |
slaveInput |
protected OutputStream |
slaveInputPipe |
protected OutputStream |
slaveOutput |
protected NonBlockingReader |
slaveReader |
protected PrintWriter |
slaveWriter |
bools, encoding, handlers, ints, name, status, strings, typeTYPE_DUMB, TYPE_DUMB_COLOR| Constructor and Description |
|---|
LineDisciplineTerminal(String name,
String type,
OutputStream masterOutput,
Charset encoding) |
LineDisciplineTerminal(String name,
String type,
OutputStream masterOutput,
Charset encoding,
Terminal.SignalHandler signalHandler) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected boolean |
doProcessInputByte(int c) |
Attributes |
getAttributes() |
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(Terminal.Signal signal) |
NonBlockingReader |
reader()
Retrieve the
Reader for this terminal. |
void |
setAttributes(Attributes attr) |
void |
setSize(Size sz) |
PrintWriter |
writer()
Retrieve the
Writer for this terminal. |
canPauseResume, checkInterrupted, echo, echo, echoSignal, encoding, enterRawMode, flush, getBooleanCapability, getCursorPosition, getKind, getName, getNumericCapability, getStatus, getStatus, getStringCapability, getType, handle, hasFocusSupport, hasMouseSupport, parseInfoCmp, pause, pause, paused, puts, readMouseEvent, readMouseEvent, resume, trackFocus, trackMouseclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetBufferSize, getHeight, getWidthprotected 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 Attributes attributes
protected final Size size
public LineDisciplineTerminal(String name, String type, OutputStream masterOutput, Charset encoding) throws IOException
IOExceptionpublic LineDisciplineTerminal(String name, String type, OutputStream masterOutput, Charset encoding, Terminal.SignalHandler signalHandler) throws IOException
IOExceptionpublic NonBlockingReader reader()
TerminalReader for this terminal.
This is the standard way to read input from this terminal.
The reader is non blocking.public PrintWriter writer()
TerminalWriter for this terminal.
This is the standard way to write to this terminal.public InputStream input()
TerminalTerminal.reader() instead.Terminal.reader()public OutputStream output()
TerminalTerminal.writer() instead.Terminal.writer()public Attributes getAttributes()
public void setAttributes(Attributes attr)
public Size getSize()
TerminalTerminal.getBufferSize()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 byteIOException - if anything wrong happenspublic void processInputBytes(byte[] input)
throws IOException
IOExceptionpublic void processInputBytes(byte[] input,
int offset,
int length)
throws IOException
IOExceptionprotected boolean doProcessInputByte(int c)
throws IOException
IOExceptionprotected void processOutputByte(int c)
throws IOException
c - the output byteIOException - if anything wrong happensprotected void processIOException(IOException ioException)
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class AbstractTerminalIOExceptionCopyright © 2019. All rights reserved.