|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uwcse.graphics.Input
A simple I/O class. Can read ints, doubles, strings, and chars. Attempts to robustly handle error inputs, by reprompting the user.
Field Summary | |
(package private) static int |
CHAR
|
(package private) static int |
DOUBLE
|
(package private) static int |
INTEGER
|
(package private) static int |
STRING
|
Constructor Summary | |
Input()
Create a new Input object. |
|
Input(java.lang.String fileName)
Create a new Input object that reads data from the file of the given name. |
Method Summary | |
protected void |
display(java.lang.String prompt)
|
boolean |
eof()
|
(package private) java.lang.Object |
getNextInput(int type)
|
static void |
main(java.lang.String[] args)
|
static Input |
newInputFromString(java.lang.String s)
Create and return a new Input object that reads data from the provided string. |
(package private) java.lang.Object |
read(int type)
|
(package private) java.lang.Object |
read(java.lang.String prompt,
int type)
|
char |
readChar()
Read a char without prompting. |
char |
readChar(java.lang.String prompt)
Display the given prompt and read an char |
double |
readDouble()
Read a double without prompting. |
double |
readDouble(java.lang.String prompt)
Display the given prompt and read an double. |
int |
readInt()
Read an integer without prompting. |
int |
readInt(java.lang.String prompt)
Display the given prompt and read an int. |
java.lang.String |
readString()
Read a string without prompting. |
java.lang.String |
readString(java.lang.String prompt)
Display the given prompt and read an string. |
Methods inherited from class java.lang.Object |
|
Field Detail |
static final int INTEGER
static final int DOUBLE
static final int STRING
static final int CHAR
Constructor Detail |
public Input()
public Input(java.lang.String fileName)
Method Detail |
public static Input newInputFromString(java.lang.String s)
protected void display(java.lang.String prompt)
java.lang.Object getNextInput(int type) throws java.io.IOException
java.lang.Object read(java.lang.String prompt, int type)
java.lang.Object read(int type)
public boolean eof()
public java.lang.String readString(java.lang.String prompt)
prompt
- the prompt to displaypublic char readChar(java.lang.String prompt)
prompt
- the prompt to displaypublic double readDouble(java.lang.String prompt)
prompt
- the prompt to displaypublic int readInt(java.lang.String prompt)
prompt
- the prompt to displaypublic java.lang.String readString()
public char readChar()
public int readInt()
public double readDouble()
public static void main(java.lang.String[] args)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |