DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2002
    Posts
    1

    Vector Serialization

    Hi,
    I am trying to save values from a vector, and reload the values when the program restarts.

    It can save the values to a file, but can't load the values. I have been picking my brain but can't figure it out.

    Read/write the vector:

    simpleSerializer S;
    f = new File ("book.dat");
    S = new simpleSerializer (f);
    //S.readObjectFromFile();
    //S.writeObjectToFile(data);


    simpleSerializer

    datastore data;
    if ((theFile!=null) && theFile.exists())
    {
    try
    {ObjectInputStream ois = new ObjectInputStream( new FileInputStream(theFile));
    data = (datastore) ois.readObject();
    ois.close();}


    Is there something simple i am missing? Any help would be greatly appreciated.

    Is there a program i could use to read the saved file to check if it is correct?
    Thanks
    Paul

  2. #2
    Join Date
    Oct 2002
    Posts
    66
    What you typed there is really odd. In the future it would help to just print your code within code tags so we can see what you're talking about.

    I can't understand exactly what you're trying to get at, but try reading the file into a String, casting/converting to your required format and then saving it into the Vector.

    If that's not what you want then please reply stating more clearly what you need (along with code).

    Thanks, hope that helps.
    Meethoss

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links