uk.ac.starlink.util
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LineReader
public LineReader()
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 promptoutStrm
- 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 promptoutStrm
- print stream to use for output - typically System.err
- Returns:
- string entered by user
- Throws:
IOException