Interface Console

All Superinterfaces:
Flushable
All Known Implementing Classes:
CharacterDevice, ConsolePrintDecorator

public interface Console extends Flushable
Mirrors java.io.Console to allow implementations to work as drop-in replacement for this class.
Since:
1.0.0
  • Method Details

    • reader

      Reader reader()
      Gets a Reader associated with the console. Invoking close() on this object will not close the underlying stream.
      Returns:
      the reader
      See Also:
    • writer

      PrintWriter writer()
      Gets a PrintWriter associated with the console. Invoking close() on this object will not close the underlying stream.
      Returns:
      the writer
      See Also:
    • format

      Console format(String fmt, Object... args)
      Writes formatted String.
      Parameters:
      fmt - format String
      args - arguments to replace format specifiers in format String
      Returns:
      this console
      See Also:
    • printf

      Console printf(String fmt, Object... args)
      Convenience method which writes formatted String.
      Parameters:
      fmt - format String
      args - arguments to replace format specifiers in format String
      Returns:
      this console
      See Also:
    • readLine

      String readLine(String fmt, Object... args)
      Writes formatted prompt and reads single line.
      Parameters:
      fmt - format String
      args - arguments to replace format specifiers in format String
      Returns:
      the line
      See Also:
    • readLine

      String readLine()
      Reads single line.
      Returns:
      the line
      See Also:
    • readPassword

      char[] readPassword(String fmt, Object... args)
      Writes formatted prompt and reads password. Hidden input should be preferred if possible. Implementations which cannot hide input should display a warning that entered text will be visible.
      Parameters:
      fmt - format String
      args - arguments to replace format specifiers in format String
      Returns:
      the password
      See Also:
    • readPassword

      char[] readPassword()
      Reads password. Hidden input should be preferred if possible. Implementations which cannot hide input should display a warning that entered text will be visible.
      Returns:
      the password
      See Also: