Userpublic class User extends Object
Fields Summary |
---|
private BufferedReader | fromUser | private BufferedWriter | toUser | private String | quit | private String | prompt |
Constructors Summary |
---|
User(Reader in, Writer out, String quitPrefix, String prompt)
fromUser = new BufferedReader(in);
toUser = new BufferedWriter(out);
quit = quitPrefix;
this.prompt = prompt;
|
Methods Summary |
---|
void | handleException(java.lang.Exception e)
toUser.write(e.getMessage());
toUser.flush();
| boolean | wantsToContinue()Return false iff the line read from the user starts with the
quit character. This is a blocking call, waiting on input
from the user
toUser.write(prompt);
toUser.newLine();
toUser.flush();
return !fromUser.readLine().startsWith(quit);
|
|