|
||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uwcse.io.Input
A simple I/O class. Can read ints, doubles, strings, chars, and booleans. Attempts to robustly handle error inputs, by reprompting the user. Can read from the keyboard or from a file (in which case no prompts are issued). Alternative operations are available to read from pop-up windows.
Constructor Summary | |
Input()
Create a new Input object to read from the terminal window or console. |
|
Input(java.lang.String fileName)
Create a new Input object that reads data from the file of the given name. |
Method Summary | |
static void |
main(java.lang.String[] args)
A test method |
boolean |
readBoolean(java.lang.String prompt)
Display the given prompt and read a boolean, i.e., the user has to type one of yes, no, true, or false, either capitalized or not, or any non-empty prefix thereof, e.g., y, t, fa, etc. |
boolean |
readBooleanDialog(java.lang.String prompt)
Display the given prompt and read a boolean, using a pop-up dialog window, i.e., the user has to type one of yes, no, true, or false, either capitalized or not, or any non-empty prefix thereof, e.g., y, t, fa, etc. |
char |
readChar(java.lang.String prompt)
Display the given prompt and read a character |
char |
readCharDialog(java.lang.String prompt)
Display the given prompt and read a character, using a pop-up dialog window. |
double |
readDouble(java.lang.String prompt)
Display the given prompt and read a double. |
double |
readDoubleDialog(java.lang.String prompt)
Display the given prompt and read a double, using a pop-up dialog window. |
int |
readInt(java.lang.String prompt)
Display the given prompt and read an integer. |
int |
readIntDialog(java.lang.String prompt)
Display the given prompt and read an integer, using a pop-up dialog window. |
java.lang.String |
readString(java.lang.String prompt)
Display the given prompt and read a single word of input. |
java.lang.String |
readStringDialog(java.lang.String prompt)
Display the given prompt and read a single word of input, using a pop-up dialog window. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Input()
public Input(java.lang.String fileName)
fileName
- the name of the file to read fromMethod Detail |
public static void main(java.lang.String[] args)
public boolean readBoolean(java.lang.String prompt)
prompt
- the prompt to displaypublic boolean readBooleanDialog(java.lang.String prompt)
prompt
- the prompt to displaypublic char readChar(java.lang.String prompt)
prompt
- the prompt to displaypublic char readCharDialog(java.lang.String prompt)
prompt
- the prompt to displaypublic double readDouble(java.lang.String prompt)
prompt
- the prompt to displaypublic double readDoubleDialog(java.lang.String prompt)
prompt
- the prompt to displaypublic int readInt(java.lang.String prompt)
prompt
- the prompt to displaypublic int readIntDialog(java.lang.String prompt)
prompt
- the prompt to displaypublic java.lang.String readString(java.lang.String prompt)
prompt
- the prompt to displaypublic java.lang.String readStringDialog(java.lang.String prompt)
prompt
- the prompt to display
|
||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |