public class BinaryDataFile
extends java.lang.Object
Constructor and Description |
---|
BinaryDataFile()
Constructs an BinaryDataFile, prompting the user via Dialog Box for a file to read from.
|
BinaryDataFile(java.io.File file)
Constructs an BinaryDataFile using the file provided.
|
BinaryDataFile(java.lang.String filename)
Constructs an BinaryDataFile 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.
|
boolean |
readBoolean()
Reads the next bytes in the file and returns them as a boolean.
|
byte |
readByte()
Reads the next byte in the file and returns it as a byte.
|
char |
readChar()
Reads the next bytes in the file and returns them as a char.
|
double |
readDouble()
Reads the next bytes in the file and returns them as a double.
|
float |
readFloat()
Reads the next bytes in the file and returns them as a float.
|
int |
readInt()
Reads the next bytes in the file and returns them as a int.
|
long |
readLong()
Reads the next bytes in the file and returns them as a long.
|
java.lang.Object |
readObject()
Reads the next bytes in the file and returns them as an Object.
|
short |
readShort()
Reads the next bytes in the file and returns them as a short.
|
java.lang.String |
readString()
Reads the next bytes in the file and returns them as a String.
|
boolean |
successful()
Returns true if the last operation was succesfull, false otherwise.
|
public BinaryDataFile()
public BinaryDataFile(java.lang.String filename)
filename
- the name of the file to read frompublic BinaryDataFile(java.io.File file)
file
- the file to read frompublic java.io.File getFile()
public boolean successful()
isEOF()
,
isDataError()
public boolean isEOF()
public boolean isDataError()
public void close()
public java.lang.Object readObject()
public byte readByte()
public char readChar()
public double readDouble()
public float readFloat()
public int readInt()
public short readShort()
public long readLong()
public java.lang.String readString()
public boolean readBoolean()