org.rhq.enterprise.communications.util.prefs
Class BufferedReaderPromptInput

java.lang.Object
  extended by org.rhq.enterprise.communications.util.prefs.BufferedReaderPromptInput
All Implemented Interfaces:
PromptInput

public class BufferedReaderPromptInput
extends Object
implements PromptInput

A simple PromptInput implementation that delegates to a buffered reader. Note that because there is no Java API that allows for reading input without echoing the typed input, this method's readLineNoEcho() really does echo (i.e. it is the same as readLine()).

Author:
John Mazzitelli

Constructor Summary
BufferedReaderPromptInput(BufferedReader r)
           
 
Method Summary
 String readLine()
          Read a line of input, allowing the user to see what is being typed.
 String readLineNoEcho()
          Read a line of input, but do not echo back to the user what is being typed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferedReaderPromptInput

public BufferedReaderPromptInput(BufferedReader r)
Method Detail

readLine

public String readLine()
                throws IOException
Description copied from interface: PromptInput
Read a line of input, allowing the user to see what is being typed.

Specified by:
readLine in interface PromptInput
Returns:
the line of input entered by the user
Throws:
IOException

readLineNoEcho

public String readLineNoEcho()
                      throws IOException
Description copied from interface: PromptInput
Read a line of input, but do not echo back to the user what is being typed. This is used mainly when asking for things like passwords in which you do not want people looking over the user's shoulder spying what is being typed.

Specified by:
readLineNoEcho in interface PromptInput
Returns:
the line of input entered by the user
Throws:
IOException


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.