posted 19 years ago
I'm not too familiar with the Serialization mechanism in Java, but I suspect that each object is the same size. If you can find out this size and the size of the file, you can easily calculate the number of objects by
As for reading every object from the file, you can use a while loop and call readObject() repeatedly, as Jeff suggested. If you just want to read the last object (or any object at a given position), you may want to look at the RandomAccessFile class.
I hope this gives you some suggestions as to what to try. If not, please come back with a description of the problem you are trying to solve. You may also want to post some code to illustrate what you have tried to solve it on your own.
Layne