uk.ac.starlink.util
Class LineReader

java.lang.Object
  extended by 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

Constructor Summary
LineReader()
           
 
Method Summary
static String readMaskedString(String prompt, PrintStream outStrm)
          Reads a line of text from the user without it being visible to onlookers.
static String readString(String prompt, PrintStream outStrm)
          Reads a line of text from the user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LineReader

public LineReader()
Method Detail

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

Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved.