aspose file tools
The moose likes Beginning Java and the fly likes Serialization Error- EOFException Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Serialization Error- EOFException" Watch "Serialization Error- EOFException" New topic
Author

Serialization Error- EOFException

Arjun Shastry
Ranch Hand

Joined: Mar 13, 2003
Posts: 1855
Hi All,
This question might have been asked many times before but was not able to find the solution.!!
On user selection of rows from JTable, I am writing the records to a file using Serialization like this-

Program is able to write the data successfully. While reading the data, when user selects the file,I am trying to deseralize it using follwing code-

At the end, I am getting EOFException(which from the docuentation is obivious:subclass of IOException).
My question is how to avoid this exception in such cases?Is there any way?
Thanks alot.>


MH
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

Do it the way most Collection classes do it: write the number of objects first. Then in the reading, you first read back that number, then read exactly that many objects.


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Serialization Error- EOFException
 
Similar Threads
how to persist the contents of HashTable ??
Store a linked list into a file
ClassCastException is occuring.
Nice Serialization Question
java.io.StreamCorruptedException: invalid stream header:i understand its a thread issue not sure fix