Class TermiosMapping

    • Method Detail

      • toAttributes

        public final Attributes toAttributes​(TermiosData tio)
        Converts native termios data to JLine Attributes.
        Parameters:
        tio - the native termios data
        Returns:
        the corresponding JLine attributes
      • toTermios

        public final TermiosData toTermios​(Attributes attr)
        Converts JLine Attributes to native termios data.

        Unmapped bits such as baud-rate flags and c_ispeed/c_ospeed are zero in the returned structure. Prefer toTermios(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 JLine Attributes onto an existing native termios snapshot.

        Mapped flags and control characters are replaced from attr. Unmapped bits (including baud-rate flags such as CBAUD/CBAUDEX), input/output speeds, and unmapped c_cc entries from existing are preserved. When existing is null, this is equivalent to toTermios(Attributes).

        Parameters:
        attr - the JLine attributes
        existing - the current native termios data, or null
        Returns:
        native termios data with JLine flags applied
      • forCurrentPlatform

        public static TermiosMapping forCurrentPlatform()
        Returns the TermiosMapping for 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