Package org.jline.terminal.impl
Class TermiosMapping
java.lang.Object
org.jline.terminal.impl.TermiosMapping
- Direct Known Subclasses:
FreeBsdTermiosMapping,LinuxTermiosMapping,OsXTermiosMapping,SolarisTermiosMapping
Converts between JLine
Attributes and platform-native TermiosData.
Each platform subclass provides EnumMap tables that map JLine flag/control-char enums
to their native bitmask or c_cc index values. The base class iterates those tables in
toTermios(Attributes) and toAttributes(TermiosData), so subclasses
are pure data declarations with no conversion logic.
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTermiosMapping(EnumMap<Attributes.InputFlag, Long> inputFlagMap, EnumMap<Attributes.OutputFlag, Long> outputFlagMap, EnumMap<Attributes.ControlFlag, Long> controlFlagMap, EnumMap<Attributes.LocalFlag, Long> localFlagMap, EnumMap<Attributes.ControlChar, Integer> controlCharMap) -
Method Summary
Modifier and TypeMethodDescriptionstatic TermiosMappingReturns theTermiosMappingfor the current operating system.final AttributestoAttributes(TermiosData tio) Converts native termios data to JLineAttributes.final TermiosDatatoTermios(Attributes attr) Converts JLineAttributesto native termios data.
-
Constructor Details
-
TermiosMapping
protected TermiosMapping(EnumMap<Attributes.InputFlag, Long> inputFlagMap, EnumMap<Attributes.OutputFlag, Long> outputFlagMap, EnumMap<Attributes.ControlFlag, Long> controlFlagMap, EnumMap<Attributes.LocalFlag, Long> localFlagMap, EnumMap<Attributes.ControlChar, Integer> controlCharMap)
-
-
Method Details
-
toAttributes
Converts native termios data to JLineAttributes.- Parameters:
tio- the native termios data- Returns:
- the corresponding JLine attributes
-
toTermios
Converts JLineAttributesto native termios data.- Parameters:
attr- the JLine attributes- Returns:
- the corresponding native termios data
-
forCurrentPlatform
Returns theTermiosMappingfor the current operating system.The result is cached after the first call via a lazy initialization holder, so this method is safe to call from any context without performance concerns.
- Returns:
- the platform-specific mapping
- Throws:
UnsupportedOperationException- if the OS is not recognized
-