File reading
Hey,
I am using a FileReader class and LineNumberReader class in order to read lines straight from a data file i created.
Currently my code reads as follows:
-----------------------------
try{ //read from file.
FileReader inputFile = new FileReader(filename);
LineNumberReader reader = new LineNumberReader(inputFile);
String name, gender, FFTID, age, balance;
while(reader.readLine()){
name = reader.readLine();
age = reader.readLine();
FFTID = reader.readLine();
balance = reader.readLine();
gender = reader.readLine();
}
}
catch(IOException e)
{
System.out.println("error reading file");
}
-----------------------------
What I want to figure out is how to tell when i reach the EOF and how to get the segment to loop so i can read multiple instances of the class from the file. Thanks in advance.
ZeWrestler
I am using a FileReader class and LineNumberReader class in order to read lines straight from a data file i created.
Currently my code reads as follows:
-----------------------------
try{ //read from file.
FileReader inputFile = new FileReader(filename);
LineNumberReader reader = new LineNumberReader(inputFile);
String name, gender, FFTID, age, balance;
while(reader.readLine()){
name = reader.readLine();
age = reader.readLine();
FFTID = reader.readLine();
balance = reader.readLine();
gender = reader.readLine();
}
}
catch(IOException e)
{
System.out.println("error reading file");
}
-----------------------------
What I want to figure out is how to tell when i reach the EOF and how to get the segment to loop so i can read multiple instances of the class from the file. Thanks in advance.
ZeWrestler
