Class TerminalBuilder

java.lang.Object
org.aesh.terminal.tty.TerminalBuilder

public final class TerminalBuilder extends Object
Builder for creating Terminal instances with configurable input/output streams and settings.
Author:
Stale W. Pedersen
  • Method Details

    • console

      public static Terminal console() throws IOException
      Creates and returns a default system Terminal.
      Returns:
      a new Terminal instance
      Throws:
      IOException - if an I/O error occurs while creating the terminal
    • builder

      public static TerminalBuilder builder()
      Creates a new TerminalBuilder instance.
      Returns:
      a new TerminalBuilder
    • name

      public TerminalBuilder name(String name)
      Sets the terminal name.
      Parameters:
      name - the terminal name
      Returns:
      this builder for method chaining
    • input

      public TerminalBuilder input(InputStream in)
      Sets the input stream for the terminal.
      Parameters:
      in - the input stream
      Returns:
      this builder for method chaining
    • output

      public TerminalBuilder output(OutputStream out)
      Sets the output stream for the terminal.
      Parameters:
      out - the output stream
      Returns:
      this builder for method chaining
    • system

      public TerminalBuilder system(boolean system)
      Sets whether to use the system terminal.
      Parameters:
      system - true to use system terminal, false otherwise
      Returns:
      this builder for method chaining
    • nativeSignals

      public TerminalBuilder nativeSignals(boolean nativeSignals)
      Sets whether to use native signal handling.
      Parameters:
      nativeSignals - true to enable native signals, false otherwise
      Returns:
      this builder for method chaining
    • type

      public TerminalBuilder type(String type)
      Sets the terminal type (e.g., "xterm", "ansi", "dumb").
      Parameters:
      type - the terminal type
      Returns:
      this builder for method chaining
    • build

      public Terminal build() throws IOException
      Builds and returns a Terminal instance with the configured settings.
      Returns:
      a new Terminal instance
      Throws:
      IOException - if an I/O error occurs while creating the terminal