What EOFException all about?,
October 5, 2008 at 5:10 AM
I have tried using the folloing code in my code to read a serialized file and an EOFException keeps being thrown all the time and interruots the running of the program and the compiler keeps highlighting the following line: System.out.println("The text : "+ obj.readObject()); ...What is the EOFException?
BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter File name : ");
String file = in.readLine();
System.out.print("Enter extention : ");
String ext = in.readLine();
String filename = file + "." + ext;
File f = new File(filename);
try{
ObjectInputStream obj = new ObjectInputStream(new FileInputStream(f)); System.out.println("The text : "+ obj.readObject()); obj.close(); System.out.println("Deserializing Operation Completly Successfully.");