|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--utilities.SimpleInput
A helper class that allows words, numbers, and booleans to be read from an input stream. This can be either System.in or a named file. All methods throw a RuntimeException object if EOF is reached when a value is requested.
Constructor Summary | |
SimpleInput()
Read input from System.in. |
|
SimpleInput(java.io.File details)
Read input from the given file. |
|
SimpleInput(java.lang.String file)
Read input from the given file. |
Method Summary | |
void |
discardLine()
Discard the remainder of the current line, if any. |
java.lang.String |
getDelimiters()
Return the current set of delimiters used in tokenizing the input. |
boolean |
nextBoolean()
Find the next boolean word on the input. |
double |
nextDouble()
Find the next numeric value on the input. |
float |
nextFloat()
Find the next numeric value on the input. |
int |
nextInt()
Find the next numeric value on the input. |
java.lang.String |
nextLine()
Return the next input line. |
long |
nextLong()
Find the next numeric value on the input. |
short |
nextShort()
Find the next numeric value on the input. |
java.lang.String |
nextWord()
Find the next word on the input. |
void |
setDelimiters(java.lang.String d)
Mutator for the delimiters to be used in tokenizing the input. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public SimpleInput()
public SimpleInput(java.lang.String file) throws java.lang.RuntimeException
file
- Read input from the named file.public SimpleInput(java.io.File details) throws java.lang.RuntimeException
details
- Read input from the given file.Method Detail |
public short nextShort() throws java.lang.RuntimeException
public int nextInt() throws java.lang.RuntimeException
public long nextLong() throws java.lang.RuntimeException
public float nextFloat() throws java.lang.RuntimeException
public double nextDouble() throws java.lang.RuntimeException
public java.lang.String nextWord() throws java.lang.RuntimeException
StringTokenizer
public boolean nextBoolean() throws java.lang.RuntimeException
public java.lang.String nextLine() throws java.lang.RuntimeException
public void discardLine()
public java.lang.String getDelimiters()
public void setDelimiters(java.lang.String d)
The
- new string of delimiters.
By default these are " \t".
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |