Class LineReader

java.lang.Object
uk.ac.starlink.util.LineReader

public class LineReader extends Object
Class containing methods for reading strings from the user (standard input). Both normal and 'masked' reads are provided - the latter is useful for reading passwords in such a way that they don't appear on the screen.
Since:
27 Nov 2006
Author:
Mark Taylor
  • Constructor Details

    • LineReader

      public LineReader()
  • Method Details

    • readString

      public static String readString(String prompt, PrintStream outStrm) throws IOException
      Reads a line of text from the user.
      Parameters:
      prompt - short line of text to act as a prompt
      outStrm - print stream to use for prompt output - typically System.err
      Throws:
      IOException
    • readMaskedString

      public static String readMaskedString(String prompt, PrintStream outStrm) throws IOException
      Reads a line of text from the user without it being visible to onlookers. Suitable utility method for soliciting passwords.
      Parameters:
      prompt - short line of text to act as a prompt
      outStrm - print stream to use for output - typically System.err
      Returns:
      string entered by user
      Throws:
      IOException