|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.skylit.io.EasyReader
EasyReader provides simple methods for reading the console and * for opening and reading text files. All exceptions are handled * inside the class and are hidden from the user. * *
Field Summary | |
protected static int |
CLOSEERROR
|
protected static int |
EOF
|
protected int |
myErrorFlags
|
protected java.lang.String |
myFileName
|
protected java.io.BufferedReader |
myInFile
|
protected static int |
OPENERROR
|
protected static int |
READERROR
|
Constructor Summary | |
EasyReader()
Constructor. |
|
EasyReader(java.lang.String fileName)
Constructor. |
Method Summary | |
boolean |
bad()
Checks the status of the file * @return true if en error occurred opening or reading the file, * false otherwise |
void |
close()
Closes the file |
boolean |
eof()
Checks the EOF status of the file * @return true if EOF was encountered in the previous read * operation, false otherwise |
char |
readChar()
Reads the next character from a file (any character including * a space or a newline character). |
double |
readDouble()
Reads the next double (without validating its format) * @return the number read or 0 if trying to read beyond the EOF |
int |
readInt()
Reads the next integer (without validating its format) * @return the integer read or 0 if trying to read beyond the EOF |
java.lang.String |
readLine()
Reads from the current position in the file up to and including * the next newline character. |
java.lang.String |
readWord()
Skips whitespace and reads the next word (a string of consecutive * non-whitespace characters (up to but excluding the next space, * newline, etc.) * @return the read string or null if trying to read beyond the EOF |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.lang.String myFileName
protected java.io.BufferedReader myInFile
protected int myErrorFlags
protected static final int OPENERROR
protected static final int CLOSEERROR
protected static final int READERROR
protected static final int EOF
Constructor Detail |
public EasyReader()
public EasyReader(java.lang.String fileName)
Method Detail |
public void close()
public boolean bad()
public boolean eof()
public char readChar()
null
character
* (unicode 0) if trying to read beyond the EOF
public java.lang.String readLine()
public java.lang.String readWord()
public int readInt()
public double readDouble()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |