Close
jGuru Forums
Posted By: OBUCHI_MACHINI Posted On: Wednesday, January 5, 2005 03:21 AM
I want to seralize an object and store it temp. whenever reqd, client request, I want to bring back the exact state it was in.. how do I do that
Re: how do I seralize an object
Posted By: Simon_Ablett Posted On: Wednesday, January 5, 2005 04:59 AM
Posted By: WarnerJan_Veldhuis Posted On: Wednesday, January 5, 2005 03:38 AM
to write:
FileOutputStream fos = new FileOutputStream("t.tmp");ObjectOutputStream oos = new ObjectOutputStream(fos);oos.writeObject( yourObject );oos.close();
to read:
FileInputStream fis = new FileInputStream("t.tmp");ObjectInputStream ois = new ObjectInputStream(fis);YourObject obj = (YourObject) ois.readObject();ois.close();