Vector Serialization


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Vector Serialization

  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

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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center