Interface Terminals

All Superinterfaces:
NativeIntegration
All Known Implementing Classes:
AbstractTerminals, PosixTerminals, WindowsTerminals

public interface Terminals extends NativeIntegration
Provides access to the terminal/console.

On UNIX based platforms, this provides access to the terminal. On Windows platforms, this provides access to the Windows console and Mintty.

To create an instance of this interface use the Native.get(Class) method.

  • Method Details

    • withAnsiOutput

      Terminals withAnsiOutput()
      Returns a copy of this terminal access that forces terminal output to use ANSI escape sequences. This can be used to force rich terminal output when not attached to a terminal.

      Terminal input is not changed.

    • isTerminal

      boolean isTerminal(Terminals.Output output) throws NativeException
      Returns true if the given output is attached to a terminal.
      Throws:
      NativeException - On failure.
    • isTerminalInput

      boolean isTerminalInput() throws NativeException
      Returns true if the system input is attached to a terminal.
      Throws:
      NativeException
    • getTerminal

      TerminalOutput getTerminal(Terminals.Output output) throws NativeException
      Returns the terminal attached to the given output.
      Returns:
      The terminal. Never returns null.
      Throws:
      NativeException - When the output is not attached to a terminal.
    • getTerminalInput

      TerminalInput getTerminalInput() throws NativeException
      Returns the terminal attached to system input
      Returns:
      The terminal. Never returns null.
      Throws:
      NativeException - When the input is not attached to a terminal.