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){}