Hi Guys
I am trying to restore the state of a program using JAVA which I saved in a file.
When the user clicks on "restore" the program should overwrite the existing object with the data from the object stored in the file.
Here is what I have:
This code reads in the object saved to file and returns it but does not overwrite the existing object.
I dont know why?
Can you help me overwrite the existing object with the object I retrieve from the file?
Thanks in advance for any help I receive
Cheers
I am trying to restore the state of a program using JAVA which I saved in a file.
When the user clicks on "restore" the program should overwrite the existing object with the data from the object stored in the file.
Here is what I have:
public Record restore(String file)
{
try
{
FileInputStream ins = new FileInputStream(file);
ObjectInputStream outs = new ObjectInputStream (ins);
Artist loadArtists = (Artist)outs.readObject();
outs.close();
return loadArtists;
}
catch (FileNotFoundException e) {System.out.println (e);}
catch (IOException e) {System.out.println (e);}
catch (ClassNotFoundException e) {System.out.println (e);}
return null;
}
This code reads in the object saved to file and returns it but does not overwrite the existing object.
I dont know why?
Can you help me overwrite the existing object with the object I retrieve from the file?
Thanks in advance for any help I receive
Cheers