|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTextInputFile
public class TextInputFile
Field Summary | |
---|---|
protected boolean |
closed
Set if the file has been closed. |
protected static int |
EMPTY
Constants and variables used by the input line buffer. |
protected boolean |
eofFlag
The end-of-file flag |
protected BufferedReader |
f
Stream used for reading input. |
protected String |
fileName
The file name. |
protected String |
lineBuffer
|
(package private) int |
lineBufferPtr
|
(package private) int |
ungotChar
|
protected boolean |
useStandardIO
Indicator whether to write to standard output or a file. |
Constructor Summary | |
---|---|
TextInputFile()
Contructor - TextInputFile to read from standard input. |
|
TextInputFile(File file)
Contructor - TextInputFile to read from a File. |
|
TextInputFile(String fileName)
Contructor - TextInputFile to read from file with specified name. |
Method Summary | |
---|---|
void |
close()
Close the file to further reading. |
boolean |
eof()
Return whether there is an eof before the next token. |
protected void |
pushACharacter(char ch)
Place the character in the unread position. |
protected char |
readACharacter()
Read a single character from the file. |
protected char |
readACharacterThrowsEOF()
Read a single character from the file. |
protected void |
readALineFromFile()
Reads a line from the file. |
protected String |
readAToken()
Reads in input from the keyboard buffer until it hits a whitespace, which indicates the end of a token. |
boolean |
readBoolean()
Read a boolean from the file. |
byte |
readByte()
Read an 8-bit integer (a "byte") from the file. |
char |
readChar()
Read a single character from the file. |
double |
readDouble()
Read a double precision floating point number (a "double") from the file. |
float |
readFloat()
Read a floating point number (a "float") from the file. |
int |
readInt()
Read a 32-bit integer (an "int") from the file. |
String |
readLine()
Read a full line of text from the file. |
long |
readLong()
Read a 64-bit integer (a "long") from the file. |
short |
readShort()
Read a 16-bit integer (a "short") from the file. |
String |
readString()
Read a whitespace delimited token from the file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean closed
protected static final int EMPTY
protected boolean eofFlag
protected BufferedReader f
protected String fileName
protected String lineBuffer
int lineBufferPtr
int ungotChar
protected boolean useStandardIO
Constructor Detail |
---|
public TextInputFile()
public TextInputFile(File file)
file
- - File to be opened.public TextInputFile(String fileName)
fileName
- - Name of the file to be opened.Method Detail |
---|
public void close()
public boolean eof()
protected void pushACharacter(char ch)
ch
- - The character to be pushed into the unread position.protected char readACharacter()
protected char readACharacterThrowsEOF() throws EOFException
EOFException
- - Thrown if attempt to read past EOF.protected void readALineFromFile() throws EOFException
EOFException
- - Thrown if attempt to read past EOF.protected String readAToken()
public boolean readBoolean()
public byte readByte()
public char readChar()
public double readDouble()
public float readFloat()
public int readInt()
public String readLine()
public long readLong()
public short readShort()
public String readString()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |