Package org.aesh.terminal.tty.impl
Class AbstractTerminal
java.lang.Object
org.aesh.terminal.tty.impl.AbstractTerminal
- All Implemented Interfaces:
Closeable,AutoCloseable,Terminal
- Direct Known Subclasses:
AbstractPosixTerminal,LineDisciplineTerminal,WinSysTerminal
Abstract base class providing common functionality for terminal implementations.
- Author:
- Stale W. Pedersen
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.aesh.terminal.Terminal
Terminal.SignalHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final DeviceThe device capabilities for this terminal.protected final Map<Signal, Terminal.SignalHandler> Map of signal types to their handlers.protected final LoggerLogger for this terminal instance.protected final StringThe terminal name.protected final StringThe terminal type (e.g., "xterm", "vt100"). -
Constructor Summary
ConstructorsConstructorDescriptionAbstractTerminal(String name, String type) Creates a new terminal with the specified name and type using default signal handling.AbstractTerminal(String name, String type, Terminal.SignalHandler signalHandler) Creates a new terminal with the specified name, type, and signal handler. -
Method Summary
Modifier and TypeMethodDescriptiondevice()booleanecho()booleanecho(boolean echo) protected voidechoSignal(Signal signal) Echoes the control character representation of a signal to the terminal output.getName()getType()Returns the terminal type identifier.handle(Signal signal, Terminal.SignalHandler handler) protected voidhandleDefaultSignal(Signal signal) Handles the default behavior for a signal when no custom handler is registered.voidMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.aesh.terminal.Terminal
getAttributes, getCodePointConsumer, getSize, input, output, setAttributes
-
Field Details
-
LOGGER
Logger for this terminal instance. -
name
The terminal name. -
type
The terminal type (e.g., "xterm", "vt100"). -
handlers
Map of signal types to their handlers. -
device
The device capabilities for this terminal.
-
-
Constructor Details
-
AbstractTerminal
Creates a new terminal with the specified name and type using default signal handling.- Parameters:
name- the terminal nametype- the terminal type- Throws:
IOException- if an I/O error occurs during initialization
-
AbstractTerminal
public AbstractTerminal(String name, String type, Terminal.SignalHandler signalHandler) throws IOException Creates a new terminal with the specified name, type, and signal handler.- Parameters:
name- the terminal nametype- the terminal typesignalHandler- the default handler for all signals- Throws:
IOException- if an I/O error occurs during initialization
-
-
Method Details
-
handle
-
raise
-
handleDefaultSignal
Handles the default behavior for a signal when no custom handler is registered. Subclasses can override this method to provide default signal handling behavior.- Parameters:
signal- the signal to handle
-
echoSignal
Echoes the control character representation of a signal to the terminal output. For example, SIGINT is echoed as "^C".- Parameters:
signal- the signal whose control character should be echoed
-
echo
public boolean echo() -
echo
public boolean echo(boolean echo) -
getName
-
getType
Returns the terminal type identifier.- Returns:
- the terminal type (e.g., "xterm", "vt100")
-
device
-