Interface ConsoleCommandHandler

All Superinterfaces:
AutoCloseable, CommandHandler
All Known Implementing Classes:
CLIHandler

public interface ConsoleCommandHandler extends CommandHandler, AutoCloseable
A CommandHandler adapted for use in command-line applications
  • Method Details

    • getConsole

      @NotNull @NotNull ConsoleActor getConsole()
      Returns the singleton ConsoleActor used by this console handler
      Returns:
      The console actor
    • pollInput

      void pollInput()
      Polls the command-line for input. This should only be called after everything has been registered!
    • create

      @NotNull static @NotNull ConsoleCommandHandler create()
      Creates a ConsoleCommandHandler that takes input and sends output to the System's default streams.
      Returns:
      The newly created console command handler
    • create

      @NotNull static @NotNull ConsoleCommandHandler create(@NotNull @NotNull InputStream inputStream)
      Creates a ConsoleCommandHandler that takes input from the given input stream and sends output to the System's default output streams.
      Parameters:
      inputStream - Input stream to poll input from
      Returns:
      The newly created console command handler
    • create

      @NotNull static @NotNull ConsoleCommandHandler create(@NotNull @NotNull InputStream inputStream, @NotNull @NotNull PrintStream outputStream)
      Creates a ConsoleCommandHandler that takes input from the given input stream and sends all output to the given output stream
      Parameters:
      inputStream - Input stream to poll input from
      outputStream - Output stream to send normal messages to. This will also be used for errors.
      Returns:
      The newly created console command handler
    • create

      @NotNull static @NotNull ConsoleCommandHandler create(@NotNull @NotNull InputStream inputStream, @NotNull @NotNull PrintStream outputStream, @NotNull @NotNull PrintStream errorStream)
      Creates a ConsoleCommandHandler that takes input from the given input stream and sends each input to the specified stream
      Parameters:
      inputStream - Input stream to poll input from
      outputStream - Output stream to send normal messages to.
      errorStream - Output stream to send error messages to.
      Returns:
      The newly created console command handler