best way to sirialize Hashtable

Hi,my Java program (1.4) fills and modifies a hashtable. And after about an hour I delete it. Now I'm searching for the BEST WAY o save the last data of hashtable when java process ends.thanks for helpgreets fabs
[255 byte] By [fabsa] at [2007-10-3 9:12:52]
# 1

HashTable ht = new HashTable();

//Fill with stuff

try {

FileOutputStream out = new FileOutputStream("data.txt");

ObjectOutputStream os = new ObjectOutputStream(out);

os.writeObject(data);//Write the HashTable to data.txt

os.flush();//Necessary

os.close();//close the file

}

catch( Exception ex ){}

//*************************************

To get it back from the file

try {

FileInputStream fis = new FileInputStream("data.txt");

ObjectInputStream is = new ObjectInputStream(fis);

HashTable ht = (HashTable)is.readObject(); //Cast the HashTable Back

}

catch(Exception ex){}

JNameNotTakena at 2007-7-15 4:25:11 > top of Java-index,Java Essentials,Java Programming...
# 2
Ok thanks for help, I actually thaugth of that way but wanted to hear some other opinions
fabsa at 2007-7-15 4:25:11 > top of Java-index,Java Essentials,Java Programming...
# 3
[oops]
ejpa at 2007-7-15 4:25:11 > top of Java-index,Java Essentials,Java Programming...