Code example for PasswordCallback

Methods: getPrompt, setPassword

0
      c.setName(name.trim());
  } 
 
  protected void handlePassword(PasswordCallback c) throws IOException
  { 
    out.print(c.getPrompt());
    BufferedReader in =
      new BufferedReader(new InputStreamReader(System.in));
    String pass = in.readLine();
    c.setPassword(pass.toCharArray());
  } 
 
  protected void handleTextInput(TextInputCallback c) throws IOException
  { 
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    out.print(c.getPrompt());
    String text = in.readLine();
    if (text != null)
      c.setText(text);
  }