Class FfmTerminalProvider

java.lang.Object
org.jline.terminal.impl.ffm.FfmTerminalProvider
All Implemented Interfaces:
org.jline.terminal.spi.TerminalProvider

public class FfmTerminalProvider extends Object implements org.jline.terminal.spi.TerminalProvider
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    boolean
    isPosixSystemStream(org.jline.terminal.spi.SystemStream stream)
     
    boolean
    isSystemStream(org.jline.terminal.spi.SystemStream stream)
     
    boolean
    isWindowsSystemStream(org.jline.terminal.spi.SystemStream stream)
     
     
    org.jline.terminal.Terminal
    newTerminal(String name, String type, InputStream in, OutputStream out, Charset encoding, Charset inputEncoding, Charset outputEncoding, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.Attributes attributes, org.jline.terminal.Size size)
     
    Register the default handler for the specified signal.
    registerSignal(String signal, Runnable handler)
    Register a handler to be invoked when the specified signal is delivered.
    systemStreamName(org.jline.terminal.spi.SystemStream stream)
     
    int
    systemStreamWidth(org.jline.terminal.spi.SystemStream stream)
    Obtain the current width, in columns, of the specified system stream.
    org.jline.terminal.Terminal
    sysTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, Charset inputEncoding, Charset outputEncoding, boolean nativeSignals, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.spi.SystemStream systemStream)
    Creates a Terminal bound to the process system streams (stdin/stdout/stderr) or an equivalent PTY-backed terminal.
    Provide a short identifying string for this terminal provider.
    void
    unregisterSignal(String signal, Object registration)
    Unregisters a previously registered signal handler; uses FFM unregistration when the provided registration is an FFM registration, otherwise uses the platform fallback.

    Methods inherited from class Object

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

    Methods inherited from interface org.jline.terminal.spi.TerminalProvider

    sysTerminal
  • Constructor Details

    • FfmTerminalProvider

      public FfmTerminalProvider()
  • Method Details

    • name

      public String name()
      Specified by:
      name in interface org.jline.terminal.spi.TerminalProvider
    • getConsoleCodepage

      public int getConsoleCodepage()
      Specified by:
      getConsoleCodepage in interface org.jline.terminal.spi.TerminalProvider
    • sysTerminal

      public org.jline.terminal.Terminal sysTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, Charset inputEncoding, Charset outputEncoding, boolean nativeSignals, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.spi.SystemStream systemStream) throws IOException
      Creates a Terminal bound to the process system streams (stdin/stdout/stderr) or an equivalent PTY-backed terminal.
      Specified by:
      sysTerminal in interface org.jline.terminal.spi.TerminalProvider
      Parameters:
      name - terminal name or identifier
      type - terminal type (TERM)
      ansiPassThrough - ignored on POSIX ? only used on Windows
      encoding - overall character set for the terminal
      inputEncoding - character set used for input decoding
      outputEncoding - character set used for output encoding
      nativeSignals - if true, attempt to use native signal handling when available
      signalHandler - handler invoked for terminal signals
      paused - ignored on POSIX ? only used on Windows and PTY-backed terminals
      systemStream - which system stream this terminal should be associated with
      Returns:
      a Terminal instance bound to the specified system stream (or an equivalent PTY-backed terminal)
      Throws:
      IOException - if the native PTY or system terminal cannot be created or accessed
    • newTerminal

      public org.jline.terminal.Terminal newTerminal(String name, String type, InputStream in, OutputStream out, Charset encoding, Charset inputEncoding, Charset outputEncoding, org.jline.terminal.Terminal.SignalHandler signalHandler, boolean paused, org.jline.terminal.Attributes attributes, org.jline.terminal.Size size) throws IOException
      Specified by:
      newTerminal in interface org.jline.terminal.spi.TerminalProvider
      Throws:
      IOException
    • isSystemStream

      public boolean isSystemStream(org.jline.terminal.spi.SystemStream stream)
      Specified by:
      isSystemStream in interface org.jline.terminal.spi.TerminalProvider
    • isWindowsSystemStream

      public boolean isWindowsSystemStream(org.jline.terminal.spi.SystemStream stream)
    • isPosixSystemStream

      public boolean isPosixSystemStream(org.jline.terminal.spi.SystemStream stream)
    • systemStreamName

      public String systemStreamName(org.jline.terminal.spi.SystemStream stream)
      Specified by:
      systemStreamName in interface org.jline.terminal.spi.TerminalProvider
    • systemStreamWidth

      public int systemStreamWidth(org.jline.terminal.spi.SystemStream stream)
      Obtain the current width, in columns, of the specified system stream.
      Specified by:
      systemStreamWidth in interface org.jline.terminal.spi.TerminalProvider
      Parameters:
      stream - the system stream whose width to query
      Returns:
      the width in columns of the given system stream
    • registerSignal

      public Object registerSignal(String signal, Runnable handler)
      Register a handler to be invoked when the specified signal is delivered.
      Specified by:
      registerSignal in interface org.jline.terminal.spi.TerminalProvider
      Parameters:
      signal - the name of the signal to handle (platform-specific string)
      handler - the runnable to execute when the signal is received
      Returns:
      an opaque registration handle that can be passed to unregisterSignal to remove the handler
    • registerDefaultSignal

      public Object registerDefaultSignal(String signal)
      Register the default handler for the specified signal.

      When FFM signal handling is available, delegates entirely to FfmSignalHandler.registerDefault(String), which may return null to preserve a foreign handler (e.g. HotSpot's SIGQUIT thread-dump handler). In that case this method also returns null ? it does not fall back to Signals.registerDefault(String) because doing so would install SIG_DFL and clobber the very handler that the FFM probe chose to preserve.

      Falls back to Signals.registerDefault(String) only when FFM signal handling is unavailable on this platform.

      Specified by:
      registerDefaultSignal in interface org.jline.terminal.spi.TerminalProvider
      Parameters:
      signal - the name of the signal (for example, "INT" or "TERM")
      Returns:
      an object representing the installed registration, or null if the signal has a foreign handler that must be preserved, or the signal is unsupported
    • unregisterSignal

      public void unregisterSignal(String signal, Object registration)
      Unregisters a previously registered signal handler; uses FFM unregistration when the provided registration is an FFM registration, otherwise uses the platform fallback.
      Specified by:
      unregisterSignal in interface org.jline.terminal.spi.TerminalProvider
      Parameters:
      signal - the name of the signal to unregister (e.g., "INT", "TERM")
      registration - the registration token returned by a prior register call
    • toString

      public String toString()
      Provide a short identifying string for this terminal provider.
      Overrides:
      toString in class Object
      Returns:
      a string of the form "TerminalProvider[]" identifying the provider