Link to home
Start Free TrialLog in
Avatar of hipal
hipalFlag for United States of America

asked on

serializing multiple objects in the same file

Thanks experts for extended support..

Can some one please give a simple example of serializing multiple objects in the same file and deserializing them
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Just call oos.writeObject several times with the corresponding ois.readObject
Avatar of hipal

ASKER

so what if I want to read 4th object that I wrote ?
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
add them to a ArrayList (or array) and then serialize/deserialize the list/array
that will handle reading/writing all objects in one call
:)