View RSS Feed

My Java Tips

  1. Retrieving serialized objects from file

    by , 11-10-2011 at 04:35 PM (My Java Tips)
    I assume that you are aware of how to serialize objects and save them into files on the disk. Now I will talk about how to retrieve serialized objects.


    You have to use FileInputStream and ObjectInputStream to fetch the object. Specify the file which contains the object in FileInputStream. Once ObjectInputStrem is initialized, just use in.readObject method of ObjectInputStream to fetch the object.

    In the following example, I am fetching a Vector from a file on disk. ...