All Implemented Interfaces:
Scrollable, InputProvider, ExtendedTerminal, Terminal, Closeable, 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 Details

    • UnixTerminal

      public UnixTerminal() throws 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:
      IOException - If there was an I/O error initializing the terminal
    • UnixTerminal

      public UnixTerminal(InputStream terminalInput, OutputStream terminalOutput, Charset terminalCharset) throws 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:
      IOException - If there was an I/O error initializing the terminal
    • UnixTerminal

      public UnixTerminal(InputStream terminalInput, OutputStream terminalOutput, Charset terminalCharset, UnixLikeTerminal.CtrlCBehaviour terminalCtrlCBehaviour) throws 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:
      IOException - If there was an I/O error initializing the terminal
    • UnixTerminal

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