Class FfmTerminalProvider
- All Implemented Interfaces:
TerminalProvider
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintRetrieve the Windows console output code page.booleanisPosixSystemStream(SystemStream stream) booleanisSystemStream(SystemStream stream) Checks if the specified system stream is available on this platform.booleanisWindowsSystemStream(SystemStream stream) name()Returns the name of this terminal provider.newTerminal(String name, String type, InputStream in, OutputStream out, Charset encoding, Charset inputEncoding, Charset outputEncoding, Terminal.SignalHandler signalHandler, boolean paused, Attributes attributes, Size size) Creates a new terminal with custom input and output streams.registerDefaultSignal(String signal) Register the default handler for the specified signal, preferring the FFM handler if available.registerSignal(String signal, Runnable handler) Register a handler to be invoked when the specified signal is delivered.systemStreamName(SystemStream stream) Returns the name of the specified system stream on this platform.intsystemStreamWidth(SystemStream stream) Obtain the current width, in columns, of the specified system stream.sysTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, Charset inputEncoding, Charset outputEncoding, boolean nativeSignals, Terminal.SignalHandler signalHandler, boolean paused, SystemStream systemStream) Creates a Terminal bound to the process system streams (stdin/stdout/stderr) or an equivalent PTY-backed terminal.toString()Provide a short identifying string for this terminal provider.voidunregisterSignal(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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.jline.terminal.spi.TerminalProvider
sysTerminal
-
Constructor Details
-
FfmTerminalProvider
public FfmTerminalProvider()
-
-
Method Details
-
name
Description copied from interface:TerminalProviderReturns the name of this terminal provider.The provider name is a unique identifier that can be used to request this specific provider when creating terminals. Common provider names include "ffm", "jni", "exec", and "dumb".
- Specified by:
namein interfaceTerminalProvider- Returns:
- the name of this terminal provider
-
getConsoleCodepage
public int getConsoleCodepage()Description copied from interface:TerminalProviderRetrieve the Windows console output code page. On Windows this returns the console output code page; on non-Windows platforms or when the code page cannot be determined this returns-1.- Specified by:
getConsoleCodepagein interfaceTerminalProvider- Returns:
- the console output code page, or
-1if not available
-
sysTerminal
public Terminal sysTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, Charset inputEncoding, Charset outputEncoding, boolean nativeSignals, Terminal.SignalHandler signalHandler, boolean paused, SystemStream systemStream) throws IOException Creates a Terminal bound to the process system streams (stdin/stdout/stderr) or an equivalent PTY-backed terminal.- Specified by:
sysTerminalin interfaceTerminalProvider- Parameters:
name- terminal name or identifiertype- terminal type (TERM)ansiPassThrough- ignored on POSIX — only used on Windowsencoding- overall character set for the terminalinputEncoding- character set used for input decodingoutputEncoding- character set used for output encodingnativeSignals- if true, attempt to use native signal handling when availablesignalHandler- handler invoked for terminal signalspaused- ignored on POSIX — only used on Windows and PTY-backed terminalssystemStream- 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 Terminal newTerminal(String name, String type, InputStream in, OutputStream out, Charset encoding, Charset inputEncoding, Charset outputEncoding, Terminal.SignalHandler signalHandler, boolean paused, Attributes attributes, Size size) throws IOException Description copied from interface:TerminalProviderCreates a new terminal with custom input and output streams.This method creates a terminal that is connected to the specified input and output streams. Such terminals can be used for various purposes, such as connecting to remote terminals over network connections or creating virtual terminals for testing.
- Specified by:
newTerminalin interfaceTerminalProvider- Parameters:
name- the name of the terminaltype- the terminal type (e.g., "xterm", "dumb")in- the input stream to read fromout- the output stream to write toencoding- the general character encoding to useinputEncoding- the character encoding to use for inputoutputEncoding- the character encoding to use for outputsignalHandler- the signal handler to usepaused- whether the terminal should start in a paused stateattributes- the initial terminal attributessize- the initial terminal size- Returns:
- a new terminal connected to the specified streams
- Throws:
IOException- if an I/O error occurs
-
isSystemStream
Description copied from interface:TerminalProviderChecks if the specified system stream is available on this platform.This method determines whether the specified system stream (standard input, standard output, or standard error) is available for use on the current platform. Some platforms or environments may restrict access to certain system streams.
- Specified by:
isSystemStreamin interfaceTerminalProvider- Parameters:
stream- the system stream to check- Returns:
trueif the system stream is available,falseotherwise
-
isWindowsSystemStream
-
isPosixSystemStream
-
systemStreamName
Description copied from interface:TerminalProviderReturns the name of the specified system stream on this platform.This method returns a platform-specific name or identifier for the specified system stream. The name may be used for display purposes or for accessing the stream through platform-specific APIs.
- Specified by:
systemStreamNamein interfaceTerminalProvider- Parameters:
stream- the system stream- Returns:
- the name of the system stream on this platform
-
systemStreamWidth
Obtain the current width, in columns, of the specified system stream.- Specified by:
systemStreamWidthin interfaceTerminalProvider- Parameters:
stream- the system stream whose width to query- Returns:
- the width in columns of the given system stream
-
registerSignal
Register a handler to be invoked when the specified signal is delivered.- Specified by:
registerSignalin interfaceTerminalProvider- 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
unregisterSignalto remove the handler
-
registerDefaultSignal
Register the default handler for the specified signal, preferring the FFM handler if available.- Specified by:
registerDefaultSignalin interfaceTerminalProvider- Parameters:
signal- the name of the signal (for example, "INT" or "TERM")- Returns:
- an object representing the installed registration; the FFM registration if one was created, otherwise the fallback Signals registration
-
unregisterSignal
Unregisters a previously registered signal handler; uses FFM unregistration when the provided registration is an FFM registration, otherwise uses the platform fallback.- Specified by:
unregisterSignalin interfaceTerminalProvider- Parameters:
signal- the name of the signal to unregister (e.g., "INT", "TERM")registration- the registration token returned by a prior register call
-
toString
-