public class ASCIIDataFile
extends java.lang.Object
Constructor and Description |
---|
ASCIIDataFile()
Constructs an ASCIIDataFile, prompting the user via Dialog Box for a file to read from.
|
ASCIIDataFile(java.io.File file)
Constructs an ASCIIDataFile using the file provided.
|
ASCIIDataFile(java.lang.String filename)
Constructs an ASCIIDataFile and tries to open a file with the path provided in the String.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the file
|
java.io.File |
getFile()
Returns the file being used
|
boolean |
isDataError()
Returns true if last operation failed because of a data error, meaning the data did not conform to format.
|
boolean |
isEOF()
Returns true if the last operation failed because of EOF, false otherwise.
|
void |
nextLine()
The next read will start at the first field (or first character) of the next line.
|
boolean |
readBoolean()
Reads the next field as a boolean.
|
byte |
readByte()
Reads the next field as a byte.
|
char |
readC()
Reads the next char in the file, including control characters (tab, newline).
|
char |
readChar()
Reads the next field as a char.
|
double |
readDouble()
Reads the next field as a double.
|
float |
readFloat()
Reads the next field as a float.
|
int |
readInt()
Reads the next field as a int.
|
java.lang.String |
readLine()
Returns an entire line, including control characters.
|
long |
readLong()
Reads the next field as a long.
|
short |
readShort()
Reads the next field as a short.
|
java.lang.String |
readString()
Reads the next field, returning it as a String.
|
void |
skipToEOL()
Deprecated.
Use nextLine() instead.
|
boolean |
successful()
Returns true if the last operation was succesfull, false otherwise.
|
public ASCIIDataFile()
public ASCIIDataFile(java.lang.String filename)
filename
- the name of the file to read frompublic ASCIIDataFile(java.io.File file)
file
- the file to read frompublic java.io.File getFile()
public void skipToEOL()
public java.lang.String readLine()
public void close()
public boolean successful()
isEOF()
,
isDataError()
public boolean isEOF()
public boolean isDataError()
public byte readByte()
public char readChar()
public char readC()
public double readDouble()
public float readFloat()
public int readInt()
public short readShort()
public long readLong()
public java.lang.String readString()
public boolean readBoolean()
public void nextLine()