Class UnixTerminal

  • All Implemented Interfaces:
    Scrollable, InputProvider, ExtendedTerminal, Terminal, java.io.Closeable, java.lang.AutoCloseable

    public class UnixTerminal
    extends UnixLikeTTYTerminal
    This class extends UnixLikeTerminal and implements the Unix-specific parts.

    If you need to have Lanterna to call stty at a different location, you'll need to subclass this and override getSTTYCommand().

    • Constructor Detail

      • UnixTerminal

        public UnixTerminal()
                     throws java.io.IOException
        Creates a UnixTerminal with default settings, using System.in and System.out for input/output, using the default character set on the system as the encoding and trap ctrl+c signal instead of killing the application.
        Throws:
        java.io.IOException - If there was an I/O error initializing the terminal
      • UnixTerminal

        public UnixTerminal​(java.io.InputStream terminalInput,
                            java.io.OutputStream terminalOutput,
                            java.nio.charset.Charset terminalCharset)
                     throws java.io.IOException
        Creates a UnixTerminal using a specified input stream, output stream and character set. Ctrl+c signal will be trapped instead of killing the application.
        Parameters:
        terminalInput - Input stream to read terminal input from
        terminalOutput - Output stream to write terminal output to
        terminalCharset - Character set to use when converting characters to bytes
        Throws:
        java.io.IOException - If there was an I/O error initializing the terminal
      • UnixTerminal

        public UnixTerminal​(java.io.InputStream terminalInput,
                            java.io.OutputStream terminalOutput,
                            java.nio.charset.Charset terminalCharset,
                            UnixLikeTerminal.CtrlCBehaviour terminalCtrlCBehaviour)
                     throws java.io.IOException
        Creates a UnixTerminal using a specified input stream, output stream and character set, with a custom size querier instead of using the default one. This way you can override size detection (if you want to force the terminal to a fixed size, for example). You also choose how you want ctrl+c key strokes to be handled.
        Parameters:
        terminalInput - Input stream to read terminal input from
        terminalOutput - Output stream to write terminal output to
        terminalCharset - Character set to use when converting characters to bytes
        terminalCtrlCBehaviour - Special settings on how the terminal will behave, see UnixTerminalMode for more details
        Throws:
        java.io.IOException - If there was an I/O error initializing the terminal
      • UnixTerminal

        private UnixTerminal​(java.io.File terminalDevice,
                             java.io.InputStream terminalInput,
                             java.io.OutputStream terminalOutput,
                             java.nio.charset.Charset terminalCharset,
                             UnixLikeTerminal.CtrlCBehaviour terminalCtrlCBehaviour)
                      throws java.io.IOException
        Throws:
        java.io.IOException