Class LineDisciplineTerminal
java.lang.Object
org.aesh.readline.terminal.impl.AbstractTerminal
org.aesh.readline.terminal.impl.LineDisciplineTerminal
- All Implemented Interfaces:
Closeable, AutoCloseable, org.aesh.terminal.Terminal
- Direct Known Subclasses:
ExternalTerminal
Abstract console with support for line discipline.
The
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 console
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.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.aesh.terminal.Terminal
org.aesh.terminal.Terminal.SignalHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.aesh.terminal.AttributesConsole dataprotected final OutputStreamprotected org.aesh.terminal.tty.Sizeprotected final InputStreamprotected final OutputStreamprotected final OutputStream -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected voidorg.aesh.terminal.Attributesorg.aesh.terminal.tty.SizegetSize()input()output()voidprocessInputByte(int c) Master input processing.voidprocessInputBytes(byte[] input) voidprocessInputBytes(byte[] input, int length) voidprocessInputBytes(int[] input, int length) protected voidprocessOutputByte(int c) Master output processing.voidraise(org.aesh.terminal.tty.Signal signal) voidsetAttributes(org.aesh.terminal.Attributes attr) Methods inherited from class AbstractTerminal
device, echo, echo, echoSignal, getName, getType, handle, handleDefaultSignalMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.aesh.terminal.Terminal
getCodePointConsumer
-
Field Details
-
masterOutput
-
slaveInputPipe
-
slaveInput
-
slaveOutput
-
attributes
protected final org.aesh.terminal.Attributes attributesConsole data -
size
protected org.aesh.terminal.tty.Size size
-
-
Constructor Details
-
LineDisciplineTerminal
public LineDisciplineTerminal(String name, String type, OutputStream masterOutput) throws IOException - Throws:
IOException
-
-
Method Details
-
input
-
output
-
getAttributes
public org.aesh.terminal.Attributes getAttributes() -
setAttributes
public void setAttributes(org.aesh.terminal.Attributes attr) -
getSize
public org.aesh.terminal.tty.Size getSize() -
raise
public void raise(org.aesh.terminal.tty.Signal signal) - Specified by:
raisein interfaceorg.aesh.terminal.Terminal- Overrides:
raisein classAbstractTerminal
-
processInputByte
Master input processing. All data coming to the console should be provided using this method.- Parameters:
c- the input byte- Throws:
IOException
-
processInputBytes
- Throws:
IOException
-
processInputBytes
- Throws:
IOException
-
processInputBytes
- Throws:
IOException
-
closeSlaveInputPipe
protected void closeSlaveInputPipe() -
processOutputByte
Master output processing. All data going to the master should be provided by this method.- Parameters:
c- the output byte- Throws:
IOException
-
close
- Throws:
IOException
-