Class TermiosMapping
- Direct Known Subclasses:
AixTermiosMapping,FreeBsdTermiosMapping,LinuxTermiosMapping,OsXTermiosMapping,SolarisTermiosMapping
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, TermiosData) 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.final TermiosDatatoTermios(Attributes attr, TermiosData existing) Converts JLineAttributesonto an existing native termios snapshot.
-
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.Unmapped bits such as baud-rate flags and
c_ispeed/c_ospeedare zero in the returned structure. PrefertoTermios(Attributes, TermiosData)when applying attributes onto an existing terminal so those fields are preserved.- Parameters:
attr- the JLine attributes- Returns:
- the corresponding native termios data
-
toTermios
Converts JLineAttributesonto an existing native termios snapshot.Mapped flags and control characters are replaced from
attr. Unmapped bits (including baud-rate flags such asCBAUD/CBAUDEX), input/output speeds, and unmappedc_ccentries fromexistingare preserved. Whenexistingisnull, this is equivalent totoTermios(Attributes).- Parameters:
attr- the JLine attributesexisting- the current native termios data, ornull- Returns:
- native termios data with JLine flags applied
-
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
-