| 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
|
 |
 |
|
|
subject: Serialization Error- EOFException
|
|
|