Class CommandRegistry.CommandSession

java.lang.Object
org.jline.console.CommandRegistry.CommandSession
Enclosing interface:
CommandRegistry

public static class CommandRegistry.CommandSession extends Object
Class representing a command execution session.

A CommandSession encapsulates the terminal and I/O streams used for command execution. It provides access to the terminal, input stream, output stream, and error stream for the command being executed.

  • Constructor Details

    • CommandSession

      public CommandSession()
      Creates a new command session with the system's standard I/O streams. The terminal will be null in this case.
    • CommandSession

      public CommandSession(Terminal terminal)
      Creates a new command session with the specified terminal. The I/O streams will be derived from the terminal.
      Parameters:
      terminal - the terminal for the command session
    • CommandSession

      public CommandSession(Terminal terminal, InputStream in, PrintStream out, PrintStream err)
      Creates a new command session with the specified terminal and I/O streams.
      Parameters:
      terminal - the terminal for the command session
      in - the input stream for the command session
      out - the output stream for the command session
      err - the error stream for the command session
  • Method Details

    • terminal

      public Terminal terminal()
      Returns the terminal for the command session.
      Returns:
      the terminal, or null if no terminal is associated with this session
    • in

      public InputStream in()
      Returns the input stream for the command session.
      Returns:
      the input stream
    • out

      public PrintStream out()
      Returns the output stream for the command session.
      Returns:
      the output stream
    • err

      public PrintStream err()
      Returns the error stream for the command session.
      Returns:
      the error stream