Package org.aesh.terminal
Class BaseDevice
java.lang.Object
org.aesh.terminal.BaseDevice
- All Implemented Interfaces:
Device
Abstract base implementation of the Device interface providing common
functionality for terminal device capabilities.
- Author:
- Ståle W. Pedersen
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.aesh.terminal.Device
Device.OscCode, Device.TerminalType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Set<Capability> Set of boolean capabilities supported by this device.protected final Map<Capability, Integer> Map of numeric capabilities and their values.protected final Map<Capability, String> Map of string capabilities and their values.protected StringThe terminal type identifier. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new BaseDevice with the default "ansi" terminal type.BaseDevice(String type) Creates a new BaseDevice with the specified terminal type. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetBooleanCapability(Capability capability) Checks if this device has the specified boolean capability.getNumericCapability(Capability capability) Gets the value of a numeric capability.getStringCapability(Capability capability) Gets the value of a string capability.int[]getStringCapabilityAsInts(Capability capability, Object... params) Gets a string capability as an array of code points, with parameter substitution.booleanOutputs a capability string to the given consumer with parameter substitution.booleanputs(Consumer<int[]> output, Capability capability, Object... params) Outputs a capability string to the given consumer with parameter substitution.type()Returns the terminal type identifier for this device.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.aesh.terminal.Device
detectTerminalType, getColorDepth, getImageProtocol, isJetBrainsTerminal, isMultiplexer, isTmuxPassthroughEnabled, supportsGraphemeClusterMode, supportsHyperlinks, supportsImages, supportsOscCode, supportsOscQueries, supportsShellIntegration, supportsSynchronizedOutput, supportsThemeQuery
-
Field Details
-
bools
Set of boolean capabilities supported by this device. -
ints
Map of numeric capabilities and their values. -
strings
Map of string capabilities and their values. -
type
The terminal type identifier.
-
-
Constructor Details
-
BaseDevice
public BaseDevice()Creates a new BaseDevice with the default "ansi" terminal type. -
BaseDevice
Creates a new BaseDevice with the specified terminal type.- Parameters:
type- the terminal type identifier
-
-
Method Details
-
type
Description copied from interface:DeviceReturns the terminal type identifier for this device. -
getBooleanCapability
Description copied from interface:DeviceChecks if this device has the specified boolean capability.- Specified by:
getBooleanCapabilityin interfaceDevice- Parameters:
capability- the capability to check- Returns:
- true if the capability is supported, false otherwise
-
getNumericCapability
Description copied from interface:DeviceGets the value of a numeric capability.- Specified by:
getNumericCapabilityin interfaceDevice- Parameters:
capability- the capability to retrieve- Returns:
- the numeric value, or null if the capability is not set
-
getStringCapability
Description copied from interface:DeviceGets the value of a string capability.- Specified by:
getStringCapabilityin interfaceDevice- Parameters:
capability- the capability to retrieve- Returns:
- the string value, or null if the capability is not set
-
getStringCapabilityAsInts
Description copied from interface:DeviceGets a string capability as an array of code points, with parameter substitution.- Specified by:
getStringCapabilityAsIntsin interfaceDevice- Parameters:
capability- the capability to retrieveparams- optional parameters to substitute into the capability string- Returns:
- the capability string as an int array of code points, or null if not set
-
puts
Description copied from interface:DeviceOutputs a capability string to the given consumer with parameter substitution. -
puts
Description copied from interface:DeviceOutputs a capability string to the given consumer with parameter substitution.- Specified by:
putsin interfaceDevice- Parameters:
output- the consumer to receive the output as an int arraycapability- the capability name to look up and outputparams- optional parameters to substitute into the capability string- Returns:
- true if the capability was found and output, false otherwise
-