Well I figured that part out! I had to use a buffered reader. Now I am stuck again though. I have read the data and divided it up with substring(num,num) like it needs to be and trimmed of the extra space. I have a while loop doing this but I can't figure out how to make the while loop do the whole file. Right now I have it using a counter but that won't work for the whole thing.
here it is: any suggestions for what the while condition should be?
import java.io.*;
import java.util.*;
import java.text.*;
import javax.swing.*;
import java.awt.font.*;
import java.awt.*;
public class Copy3 {
public static void main(String[] args) throws IOException {
BufferedReader input = new BufferedReader( new FileReader( "fruits.dat" ));
StringBuffer buffer = new StringBuffer();
String text;
String complete;
String idstring;
String statestring;
String datestring;
String fruitstring;
String gradestring;
String coststring;
String otheroutput;
int counting;
counting = 1;
//otheroutput=input.readLine();
while (counting != 6) {
complete=input.readLine();
if (complete.substring(0,1).equals(" ") )
{
fruitstring=complete.substring(10,20);
fruitstring=fruitstring.trim();
gradestring=complete.substring(20,22);
gradestring=gradestring.trim();
coststring=complete.substring(22,30);
coststring=coststring.trim();
System.out.println(fruitstring);
System.out.println(gradestring);
System.out.println(coststring);
}
else
{
idstring=complete.substring(0,10);
statestring=complete.substring(10,12);
datestring=complete.substring(12,20);
System.out.println(idstring);
System.out.println(statestring);
System.out.println(datestring);
}
//otheroutput=input.readLine();
counting=counting + 1;
}
}
}