Interface Console

All Known Implementing Classes:
OSGiConsole

@NonNullByDefault public interface Console
This interface must be implemented by consoles which want to use the ConsoleInterpreter. It allows basic output commands.
Author:
Kai Kreuzer - Initial contribution
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    default void
    printf(String format, Object... args)
     
    void
     
    void
    usage output is treated differently from other output as it might differ between different kinds of consoles
    default String
    readLine(String prompt, @Nullable Character mask)
    Reads a line from the console.
  • Method Details

    • printf

      default void printf(String format, Object... args)
    • print

      void print(String s)
    • println

      void println(String s)
    • printUsage

      void printUsage(String s)
      usage output is treated differently from other output as it might differ between different kinds of consoles
      Parameters:
      s - the main usage string (console independent)
    • readLine

      default String readLine(String prompt, @Nullable Character mask) throws IOException
      Reads a line from the console. The prompt is displayed before the line is read.
      Parameters:
      prompt - the prompt to display
      mask - the character to use for masking input (e.g. '*'), or null if no masking is required
      Returns:
      the line read from the console
      Throws:
      IOException - if an I/O error occurs