• Post Reply Bookmark Topic Watch Topic
  • New Topic

Object to a textfile and retrive them back  RSS feed

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you store objects? lets say you store a couple of person objects in a textfile using ArrayList, you turn the computer off and go to sleep.
How do you the next day retrieve the information from the textfile back into the ArrayList ?

thanks
Mike
 
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mike,
Welcome to the Ranch.

By "text" file I take it you mean a human readable format. If yes, check out the API for XMLEncoder and XMLDecoder.
Another way is to serialize the objects to the disk. More about it here http://java.sun.com/developer/technicalArticles/Programming/serialization/
Of course, there is always a database
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!