Class AbstractTerminal

java.lang.Object
org.aesh.terminal.tty.impl.AbstractTerminal
All Implemented Interfaces:
Closeable, AutoCloseable, org.aesh.terminal.Terminal
Direct Known Subclasses:
AbstractPosixTerminal, LineDisciplineTerminal, WinSysTerminal

public abstract class AbstractTerminal extends Object implements org.aesh.terminal.Terminal
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

    org.aesh.terminal.Terminal.SignalHandler
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.aesh.terminal.Device
    The device capabilities for this terminal.
    protected final Map<org.aesh.terminal.tty.Signal, org.aesh.terminal.Terminal.SignalHandler>
    Map of signal types to their handlers.
    protected final Logger
    Logger for this terminal instance.
    protected final String
    The terminal name.
    protected final String
    The terminal type (e.g., "xterm", "vt100").

    Fields inherited from interface org.aesh.terminal.Terminal

    READ_EXPIRED
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new terminal with the specified name and type using default signal handling.
    AbstractTerminal(String name, String type, org.aesh.terminal.Terminal.SignalHandler signalHandler)
    Creates a new terminal with the specified name, type, and signal handler.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.aesh.terminal.Device
     
    boolean
     
    boolean
    echo(boolean echo)
     
    protected void
    echoSignal(org.aesh.terminal.tty.Signal signal)
    Echoes the control character representation of a signal to the terminal output.
     
    Returns the terminal type identifier.
    org.aesh.terminal.Terminal.SignalHandler
    handle(org.aesh.terminal.tty.Signal signal, org.aesh.terminal.Terminal.SignalHandler handler)
     
    protected void
    handleDefaultSignal(org.aesh.terminal.tty.Signal signal)
    Handles the default behavior for a signal when no custom handler is registered.
    void
    raise(org.aesh.terminal.tty.Signal signal)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface Closeable

    close

    Methods inherited from interface org.aesh.terminal.Terminal

    getAttributes, getCodePointConsumer, getSize, input, output, peek, read, read, setAttributes, supportsNonBlockingRead
  • Field Details

    • LOGGER

      protected final Logger LOGGER
      Logger for this terminal instance.
    • name

      protected final String name
      The terminal name.
    • type

      protected final String type
      The terminal type (e.g., "xterm", "vt100").
    • handlers

      protected final Map<org.aesh.terminal.tty.Signal, org.aesh.terminal.Terminal.SignalHandler> handlers
      Map of signal types to their handlers.
    • device

      protected final org.aesh.terminal.Device device
      The device capabilities for this terminal.
  • Constructor Details

    • AbstractTerminal

      public AbstractTerminal(String name, String type)
      Creates a new terminal with the specified name and type using default signal handling.
      Parameters:
      name - the terminal name
      type - the terminal type
    • AbstractTerminal

      public AbstractTerminal(String name, String type, org.aesh.terminal.Terminal.SignalHandler signalHandler)
      Creates a new terminal with the specified name, type, and signal handler.
      Parameters:
      name - the terminal name
      type - the terminal type
      signalHandler - the default handler for all signals
  • Method Details

    • handle

      public org.aesh.terminal.Terminal.SignalHandler handle(org.aesh.terminal.tty.Signal signal, org.aesh.terminal.Terminal.SignalHandler handler)
      Specified by:
      handle in interface org.aesh.terminal.Terminal
    • raise

      public void raise(org.aesh.terminal.tty.Signal signal)
      Specified by:
      raise in interface org.aesh.terminal.Terminal
    • handleDefaultSignal

      protected void handleDefaultSignal(org.aesh.terminal.tty.Signal signal)
      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

      protected void echoSignal(org.aesh.terminal.tty.Signal signal)
      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()
      Specified by:
      echo in interface org.aesh.terminal.Terminal
    • echo

      public boolean echo(boolean echo)
      Specified by:
      echo in interface org.aesh.terminal.Terminal
    • getName

      public String getName()
      Specified by:
      getName in interface org.aesh.terminal.Terminal
    • getType

      public String getType()
      Returns the terminal type identifier.
      Returns:
      the terminal type (e.g., "xterm", "vt100")
    • device

      public org.aesh.terminal.Device device()
      Specified by:
      device in interface org.aesh.terminal.Terminal