Class TerminalLineSettings


  • public final class TerminalLineSettings
    extends java.lang.Object
    Provides access to terminal line settings via stty.
    Since:
    2.0
    • Field Detail

      • UNDEFINED

        private static final java.lang.String UNDEFINED
      • SUPPORTS_REDIRECT

        private static final boolean SUPPORTS_REDIRECT
      • REDIRECT_INHERIT

        private static final java.lang.Object REDIRECT_INHERIT
      • REDIRECT_INPUT_METHOD

        private static final java.lang.reflect.Method REDIRECT_INPUT_METHOD
      • sttyCommand

        private java.lang.String sttyCommand
      • shCommand

        private java.lang.String shCommand
      • ttyDevice

        private java.lang.String ttyDevice
      • config

        private java.lang.String config
      • initialConfig

        private java.lang.String initialConfig
      • configLastFetched

        private long configLastFetched
      • useRedirect

        private boolean useRedirect
    • Constructor Detail

      • TerminalLineSettings

        @Deprecated
        public TerminalLineSettings()
                             throws java.io.IOException,
                                    java.lang.InterruptedException
        Deprecated.
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • TerminalLineSettings

        @Deprecated
        public TerminalLineSettings​(java.lang.String ttyDevice)
                             throws java.io.IOException,
                                    java.lang.InterruptedException
        Deprecated.
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • TerminalLineSettings

        private TerminalLineSettings​(java.lang.String ttyDevice,
                                     boolean unused)
                              throws java.io.IOException,
                                     java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
    • Method Detail

      • getSettings

        public static TerminalLineSettings getSettings​(java.lang.String device)
                                                throws java.io.IOException,
                                                       java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • getTtyDevice

        public java.lang.String getTtyDevice()
      • getConfig

        public java.lang.String getConfig()
      • restore

        public void restore()
                     throws java.io.IOException,
                            java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • get

        public java.lang.String get​(java.lang.String args)
                             throws java.io.IOException,
                                    java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • set

        public void set​(java.lang.String args)
                 throws java.io.IOException,
                        java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • set

        public void set​(java.lang.String... args)
                 throws java.io.IOException,
                        java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • undef

        public void undef​(java.lang.String name)
                   throws java.io.IOException,
                          java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • getProperty

        public int getProperty​(java.lang.String name)

        Get the value of a stty property, including the management of a cache.

        Parameters:
        name - the stty property.
        Returns:
        the stty property value.
      • getPropertyAsString

        public java.lang.String getPropertyAsString​(java.lang.String name)
      • fetchConfig

        private boolean fetchConfig​(java.lang.String name)
      • getPropertyAsString

        protected static java.lang.String getPropertyAsString​(java.lang.String name,
                                                              java.lang.String stty)

        Parses a stty output (provided by stty -a) and return the value of a given property.

        Parameters:
        name - property name.
        stty - string resulting of stty -a execution.
        Returns:
        value of the given property.
      • getProperty

        protected static int getProperty​(java.lang.String name,
                                         java.lang.String stty)
      • parseControlChar

        private static int parseControlChar​(java.lang.String str)
      • stty

        private java.lang.String stty​(java.lang.String... args)
                               throws java.io.IOException,
                                      java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • exec

        private java.lang.String exec​(java.lang.String... cmd)
                               throws java.io.IOException,
                                      java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • inheritInput

        private static java.lang.ProcessBuilder inheritInput​(java.lang.ProcessBuilder pb)
                                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • waitAndCapture

        public static java.lang.String waitAndCapture​(java.lang.Process p)
                                               throws java.io.IOException,
                                                      java.lang.InterruptedException
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • close

        private static void close​(java.io.Closeable... closeables)