When serializing objects, I set,
FileOutputStream fileOutputStream = new FileOutputStream(path +"\\"+filename,true);
to append objects to serializing file. As an example, I serialize Email objects into the same file.
when deserializing these saved objects, I wanted to get all objects, but It gives only the very first object.
ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream);
Email sentEmail = (Email) objectInputStream.readObject();
I found a similar question about this,
Deserialize many objects in java? but there is no, objectInputStream.hasNext() method. So, how to get all objects when deserializing?