org.ujac.util.console
Class PasswordReader

java.lang.Object
  extended by org.ujac.util.console.PasswordReader
All Implemented Interfaces:
Runnable

public class PasswordReader
extends Object
implements Runnable

Name: PasswordReader
Description: Reads a password from console input and tries to hide the typed characters.

Author:
lauerc

Constructor Summary
PasswordReader(String prompt)
          Constructs a PasswordReader with no specific attributes.
 
Method Summary
static void main(String[] args)
          The main method for testing purposes.
 String readPassword()
          Reads the password from the command line.
 void run()
          Begins masking until asked to stop.
 void stopMasking()
          Instructs the thread to stop masking.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PasswordReader

public PasswordReader(String prompt)
Constructs a PasswordReader with no specific attributes.

Parameters:
prompt - The command line prompt.
Method Detail

run

public void run()
Begins masking until asked to stop.

Specified by:
run in interface Runnable

stopMasking

public void stopMasking()
Instructs the thread to stop masking.


readPassword

public String readPassword()
                    throws IOException
Reads the password from the command line.

Returns:
The password as entered by the user.
Throws:
IOException - In case the console input failed.

main

public static void main(String[] args)
The main method for testing purposes.

Parameters:
args - The command line arguments.


Copyright © 2003-2004 UJAC.org. All Rights Reserved.