public class FileIO
extends java.lang.Object
Constructor and Description |
---|
FileIO() |
Modifier and Type | Method and Description |
---|---|
void |
closeRead()
A SUPPORT method that closes the current file which is open for READING.
|
void |
closeWrite()
A SUPPORT method that closes the current file which is open for READING.
|
static java.lang.String |
getFileName(boolean save,
javafx.stage.Window stage)
A SUPPORT method that opens a FileChooser (pop-up window that allows you to
navigate your computer to choose a file to load or save to.
|
boolean |
hasMoreData()
A SUPPORT method that returns whether there is more data to be read from the file
that is currently open for reading.
|
void |
openRead(java.lang.String filename)
A SUPPORT method that opens the file specified by 'filename' for reading.
|
void |
openWrite(java.lang.String filename)
A SUPPORT method that opens the file specified by 'filename' for writing.
|
double |
readDouble()
A SUPPORT method that reads the next entry in the file and returns it
as a double.
|
int |
readInt()
A SUPPORT method that reads the next entry in the file and returns it
as an integer.
|
java.lang.String |
readString()
A SUPPORT method that reads the next entry in the file and returns it
as a string.
|
void |
writeDouble(double num)
A SUPPORT method that adds an entry to the end of the current file open for
writing.
|
void |
writeInt(int num)
A SUPPORT method that adds an entry to the end of the current file open for
writing.
|
void |
writeString(java.lang.String message)
A SUPPORT method that adds an entry to the end of the current file open for
writing.
|
public void closeRead()
public void closeWrite()
public static java.lang.String getFileName(boolean save, javafx.stage.Window stage)
save
- a boolean value - pass TRUE if you're saving, FALSE if loadingstage
- your program's Stagepublic boolean hasMoreData()
public void openRead(java.lang.String filename)
filename
- The pathname of the file to be opened for reading.public void openWrite(java.lang.String filename)
filename
- The pathname of the file to be opened for writing.public double readDouble()
public int readInt()
public java.lang.String readString()
public void writeDouble(double num)
num
- The double to write to the filepublic void writeInt(int num)
num
- The integer to write to the filepublic void writeString(java.lang.String message)
message
- The string to write to the file