Reputation: 547
what is available way in serialization API to loop through all objects stored in media(file/db) other than catching EOFException
in while(true)
loop, adding number of objects count at the start of file before writing objects or storing array or collection in file instead of individual objects?
If different type of objects are stored in file and they are not stored through array/collection, how to iterate using ObjectInputStream
?
Upvotes: 1
Views: 1972
Reputation: 13139
All ways work:
No other options are available (as far as I'm aware).
Upvotes: 3