   java end of file help
  Hello,I need help in java with eof detection. Here is part of a program I'm just messing around with. public void objTestRead(ObjectInputStream i) throws IOException, ClassNotFoundException{Employee emp;try{do{emp = (Employee) i.readObject();System.out.println("Name: " + emp.getName());System.out.println("Pay: " + emp.getAmt());System.out.println("Date: " + emp.getList().get(0));}while(true);}catch(EOFException e){System.out.print("End of file!!");i.close();}catch(IOException e){System.out.print("Error message: " + e);}catch(ClassNotFoundException e){System.out.print("Error message: " + e);}  }Is there a better way of doing what I tried to do? I couldn't think of any other way other than while(i.readObject!=null) but that didn't work too well :(   
  Is it working?  If it is, I don't see anything wrong with how you are approaching it.-Jeff   ;  Thanks for the reply,It works fine, but I was wondering if there was an alternative method of handling it.   ;  I think you're handling it in exactly the way the creators of Java would have wanted it.  The exceptions are there for a reason and you're taking advantage of the fact they're there.-Jeff   