wood burning stoves 2.0*
The moose likes Java in General and the fly likes Saving and loading question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Saving and loading question" Watch "Saving and loading question" New topic
Author

Saving and loading question

Marcus Senna
Greenhorn

Joined: Feb 22, 2007
Posts: 21
Hey, I am creating an application which allows users to simulate certain communications protocols. This application would allow users to configure networks using network components such as routers and hosts by dragging and dropping images of them onto a configuration area. Therefore, as an image is dropped onto the area, objects would be created and certain parameters set.
One of the requirements of the application is to allow users to save configurations so that there could be loaded in the future.
Could anyone give me ideas on how I would be able to save the configurations along with the parameters? Thanks in advance.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Broadly, there are two ways: save the Java objects directly using serialization, or define a structured file format to translate your objects into as they are saved. Serialization is easy, but opaque and potentially fragile if your code changes. Defining and using a custom file format may or may not be difficult. It might be something you define from scratch, or you could just use an established format like XML. The advantage of using something like XML is you can use a pre-existing parser and tools for writing the file format.


[Jess in Action][AskingGoodQuestions]
Marcus Senna
Greenhorn

Joined: Feb 22, 2007
Posts: 21
Could you tell me of any website or book that would give me information on using either of these two techniques?...thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Saving and loading question