Class DumbTerminalProvider
- All Implemented Interfaces:
TerminalProvider
The DumbTerminalProvider class provides a TerminalProvider implementation that creates DumbTerminal instances. Dumb terminals have minimal capabilities and are used as a fallback when more capable terminal implementations cannot be created or when running in environments with limited terminal support.
This provider supports two types of dumb terminals:
- Standard dumb terminal (
Terminal.TYPE_DUMB
) - No color support - Color dumb terminal (
Terminal.TYPE_DUMB_COLOR
) - Basic color support
The provider name is "dumb", which can be specified in the org.jline.terminal.provider
system property to force the use of this provider. This is useful in environments
where other terminal providers might not work correctly or when terminal capabilities
are not needed.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
isSystemStream
(SystemStream stream) Checks if the specified system stream is available on this platform.name()
Returns the name of this terminal provider.newTerminal
(String name, String type, InputStream masterInput, OutputStream masterOutput, Charset encoding, Charset stdinEncoding, Charset stdoutEncoding, Charset stderrEncoding, Terminal.SignalHandler signalHandler, boolean paused, Attributes attributes, Size size) Creates a new terminal with custom input and output streams.systemStreamName
(SystemStream stream) Returns the name of the specified system stream on this platform.int
systemStreamWidth
(SystemStream stream) Returns the width (number of columns) of the specified system stream.sysTerminal
(String name, String type, boolean ansiPassThrough, Charset encoding, Charset stdinEncoding, Charset stdoutEncoding, Charset stderrEncoding, boolean nativeSignals, Terminal.SignalHandler signalHandler, boolean paused, SystemStream systemStream) Creates a terminal connected to a system stream.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.jline.terminal.spi.TerminalProvider
newTerminal, sysTerminal
-
Constructor Details
-
DumbTerminalProvider
public DumbTerminalProvider()
-
-
Method Details
-
name
Description copied from interface:TerminalProvider
Returns 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", "jansi", "jna", "exec", and "dumb".
- Specified by:
name
in interfaceTerminalProvider
- Returns:
- the name of this terminal provider
-
sysTerminal
public Terminal sysTerminal(String name, String type, boolean ansiPassThrough, Charset encoding, Charset stdinEncoding, Charset stdoutEncoding, Charset stderrEncoding, boolean nativeSignals, Terminal.SignalHandler signalHandler, boolean paused, SystemStream systemStream) throws IOException Description copied from interface:TerminalProvider
Creates a terminal connected to a system stream.This method creates a terminal that is connected to one of the standard system streams (standard input, standard output, or standard error). Such terminals typically represent the actual terminal window or console that the application is running in.
- Specified by:
sysTerminal
in interfaceTerminalProvider
- Parameters:
name
- the name of the terminaltype
- the terminal type (e.g., "xterm", "dumb")ansiPassThrough
- whether to pass through ANSI escape sequencesencoding
- the general character encoding to usestdinEncoding
- the character encoding to use for standard inputstdoutEncoding
- the character encoding to use for standard outputstderrEncoding
- the character encoding to use for standard errornativeSignals
- whether to use native signal handlingsignalHandler
- the signal handler to usepaused
- whether the terminal should start in a paused statesystemStream
- the system stream to connect to- Returns:
- a new terminal connected to the specified system stream
- Throws:
IOException
- if an I/O error occurs
-
newTerminal
public Terminal newTerminal(String name, String type, InputStream masterInput, OutputStream masterOutput, Charset encoding, Charset stdinEncoding, Charset stdoutEncoding, Charset stderrEncoding, Terminal.SignalHandler signalHandler, boolean paused, Attributes attributes, Size size) throws IOException Description copied from interface:TerminalProvider
Creates 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:
newTerminal
in interfaceTerminalProvider
- Parameters:
name
- the name of the terminaltype
- the terminal type (e.g., "xterm", "dumb")masterInput
- the input stream to read frommasterOutput
- the output stream to write toencoding
- the general character encoding to usestdinEncoding
- the character encoding to use for standard inputstdoutEncoding
- the character encoding to use for standard outputstderrEncoding
- the character encoding to use for standard errorsignalHandler
- 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:TerminalProvider
Checks 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:
isSystemStream
in interfaceTerminalProvider
- Parameters:
stream
- the system stream to check- Returns:
true
if the system stream is available,false
otherwise
-
systemStreamName
Description copied from interface:TerminalProvider
Returns 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:
systemStreamName
in interfaceTerminalProvider
- Parameters:
stream
- the system stream- Returns:
- the name of the system stream on this platform
-
systemStreamWidth
Description copied from interface:TerminalProvider
Returns the width (number of columns) of the specified system stream.This method determines the width of the terminal associated with the specified system stream. The width is measured in character cells and represents the number of columns available for display.
- Specified by:
systemStreamWidth
in interfaceTerminalProvider
- Parameters:
stream
- the system stream- Returns:
- the width of the system stream in character columns
-
toString
-