Board index » jbuilder » Saving a Hashtable(best way.)

Saving a Hashtable(best way.)


2004-05-12 04:34:18 AM
jbuilder6
I'm trying to save a Hashtable to a file. can I write and readObject Hashtable or do i save the elements individually.
 
 

Re:Saving a Hashtable(best way.)

I'm trying to save a Hashtable to a file. can I write and readObject Hashtable or do i save the elements individually.
I'm Object(Output/Input)Stream then I write each key and each value object. I was just going to experment but I'm fearing coruption of the file.
Also, is there an option in FileOutputStream to force overwrite.
if so what do I look for. I was just going to delete the file and write new, but that don't seem solid.
 

Re:Saving a Hashtable(best way.)

On 11 May 2004 13:37:37 -0700, Joe Vasher < XXXX@XXXXX.COM >wrote:
Quote
I'm trying to save a Hashtable to a file. can I write and readObject
Hashtable or do i save the elements individually.
You can write any object that has a type implementing Serializable.
Quote
Also, is there an option in FileOutputStream to force overwrite.
Yes, there is a constructor for that, but beware...
Quote
if so what do I look for. I was just going to delete the file and write
new, but that don't seem solid.
... and instead try writing to a temporary file and when the write
succeeds, remove the old file and rename the temp file.
--
Using Opera's revolutionary e-mail client: www.opera.com/m2/
 

{smallsort}