Link to home
Create AccountLog 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
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
add them to a ArrayList (or array) and then serialize/deserialize the list/array
that will handle reading/writing all objects in one call
:)