- java.lang.Object
-
- org.jline.terminal.impl.TermiosMapping
-
- Direct Known Subclasses:
AixTermiosMapping,FreeBsdTermiosMapping,LinuxTermiosMapping,OsXTermiosMapping,SolarisTermiosMapping
public abstract class TermiosMapping extends java.lang.ObjectConverts between JLineAttributesand platform-nativeTermiosData.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)andtoAttributes(TermiosData), so subclasses are pure data declarations with no conversion logic.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedTermiosMapping(java.util.EnumMap<Attributes.InputFlag,java.lang.Long> inputFlagMap, java.util.EnumMap<Attributes.OutputFlag,java.lang.Long> outputFlagMap, java.util.EnumMap<Attributes.ControlFlag,java.lang.Long> controlFlagMap, java.util.EnumMap<Attributes.LocalFlag,java.lang.Long> localFlagMap, java.util.EnumMap<Attributes.ControlChar,java.lang.Integer> controlCharMap)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TermiosMappingforCurrentPlatform()Returns theTermiosMappingfor the current operating system.AttributestoAttributes(TermiosData tio)Converts native termios data to JLineAttributes.TermiosDatatoTermios(Attributes attr)Converts JLineAttributesto native termios data.TermiosDatatoTermios(Attributes attr, TermiosData existing)Converts JLineAttributesonto an existing native termios snapshot.
-
-
-
Constructor Detail
-
TermiosMapping
protected TermiosMapping(java.util.EnumMap<Attributes.InputFlag,java.lang.Long> inputFlagMap, java.util.EnumMap<Attributes.OutputFlag,java.lang.Long> outputFlagMap, java.util.EnumMap<Attributes.ControlFlag,java.lang.Long> controlFlagMap, java.util.EnumMap<Attributes.LocalFlag,java.lang.Long> localFlagMap, java.util.EnumMap<Attributes.ControlChar,java.lang.Integer> controlCharMap)
-
-
Method Detail
-
toAttributes
public final Attributes toAttributes(TermiosData tio)
Converts native termios data to JLineAttributes.- Parameters:
tio- the native termios data- Returns:
- the corresponding JLine attributes
-
toTermios
public final TermiosData toTermios(Attributes attr)
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
public final TermiosData toTermios(Attributes attr, TermiosData existing)
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
public static TermiosMapping 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:
java.lang.UnsupportedOperationException- if the OS is not recognized
-
-