I am working on a program that displays a object from my Stock class in a jlist. I have it working where I can write this information to a file but when I try to read from that same file my program just freezes. I am wondering if I have my code set up wrong to read from the file as this is my first time trying that. All I am looking to do is set the variables for my Stock object from the saved variables in the file. Thanks
public void getData(){
StringTokenizer row;
Stock aStock = new Stock();
try{
BufferedReader inbuffer = new BufferedReader(new FileReader(fileName));
String inputString;
inputString = inbuffer.readLine();
while(inputString != null){
row = new StringTokenizer(inputString, DELIMTER);
aStock.setStockName(row.nextToken());
aStock.setStockQuantity(Integer.parseInt(row.nextToken()));
aStock.setPurchasePrice(Double.parseDouble(row.nextToken()));
aStock.setCurrentPrice(Double.parseDouble(row.nextToken()));
}
inbuffer.close();
}
catch(IOException ioe){
JOptionPane.showMessageDialog(null, ioe.getMessage(), "File Read Error", JOptionPane.ERROR);
}
}