• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Serialization Error- EOFException

 
Ranch Hand
Posts: 1907
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.>
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic