Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro Java
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Pro Java Expert level Java questions not about a specific book. Please indicate your version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Java section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 20th, 2007, 03:33 AM
Registered User
Join Date: May 2005
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Serialization & Deserialization

Hi All,

How to deserialize all the objects stored in a file.?

I am storing random number of objects into a file using ObjectOutputStream and is working file n i also know that using readObjectof ObjectInputStream we can read the object. But the thing is (1)how will i know how many objects are there in the file?
   (2)how to read all the objects which are instances of the same class from the file?

Thanks in advance

Reply With Quote
  #2 (permalink)  
Old April 23rd, 2007, 11:50 PM
Friend of Wrox
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post


Read an object from the file assign it to an Object class variable and use the getClass() method to get the class name, and compare it with required class name if equal continue your process, else continue reading another object.

Reply With Quote
  #3 (permalink)  
Old September 7th, 2007, 10:13 AM
ski ski is offline
Registered User
Join Date: Sep 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts


I think, you should have all the objects present and it can be object hierarchy as well, and now while deserializing, it will construct the
entire object graph.

There are some questions and answers to serialization and deserialization, I came across


Hope this helps.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Serialization and DeSerialization balesh.mind ASP.NET 2.0 Professional 0 September 12th, 2007 05:05 AM
Deserialization of a file Mr. Vage C# 2005 2 July 16th, 2007 08:11 PM
Serialization (beginning & end) freezotic BOOK: Beginning Java 2 1 June 20th, 2007 01:21 PM
Linux & KDE & C++ & QT & MYSQL & Kdevelop Munnnki Linux 0 January 2nd, 2005 05:41 PM

All times are GMT -4. The time now is 03:48 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.