[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Amber Star

11/6/2002 8:08:00 PM

Hi,
I'm new to programming.. Can anyone steer me in the right direction. I want
to searailize objects out to a binary file, and selectivly load and save
them as individual objects into one file. What is the common technique for
such functionality. Do I need to write an index out to keep track of the
location of each object in the file.. What do I do if an object grows.. I
don't want to write over the next object in the stream... Any help would be
great!

Thanks,
Amber


2 Answers

Manish Godse [MS]

11/6/2002 9:18:00 PM

0

One possible suggestion is to first instead of writing to a file you could
write to the cache. If you have a file already created with data first read
from the file into the cache add your new object to the cache or an existing
object that is larger and then write to the file without appending. Just
write over the file. Remember that this is only a suggestion.

--
Please do not send email directly to this alias. This alias is for newsgroup
purposes only.

This posting is provided \"AS IS\" with no warranties, and confers no
rights.

"Amber Star" <amberalphastar@yahoo.com> wrote in message
news:eloMrechCHA.2288@tkmsftngp12...
> Hi,
> I'm new to programming.. Can anyone steer me in the right direction. I
want
> to searailize objects out to a binary file, and selectivly load and save
> them as individual objects into one file. What is the common technique for
> such functionality. Do I need to write an index out to keep track of the
> location of each object in the file.. What do I do if an object grows.. I
> don't want to write over the next object in the stream... Any help would
be
> great!
>
> Thanks,
> Amber
>
>


Phil Wilson

11/7/2002 8:45:00 PM

0

One of the things you could think about is having a hosting object that contains something like an
ArrayList containing references to all the objects you care about. When you serialize this hosting
object to disk, it will (or you can make it) serialize all the objects in the ArrayList. To update
something, you serialize back from the file back into the hosting object, getting all your objects
back in the ArrayList. You then do whatever manipulation you need to the objects in the ArrayList,
then serialize the hosting object (and its contained objects) back to disk again. If you're
unwilling to use an actual database to store the individual objects (or write equivalent
functionality), I'd say you're pretty much stuck with the "read everything in, update it, write it
all out again" model.

"Amber Star" <amberalphastar@yahoo.com> wrote in message news:eloMrechCHA.2288@tkmsftngp12...
> Hi,
> I'm new to programming.. Can anyone steer me in the right direction. I want
> to searailize objects out to a binary file, and selectivly load and save
> them as individual objects into one file. What is the common technique for
> such functionality. Do I need to write an index out to keep track of the
> location of each object in the file.. What do I do if an object grows.. I
> don't want to write over the next object in the stream... Any help would be
> great!
>
> Thanks,
> Amber
>
>