This content has been marked as final. Show 3 replies
I'll try to explain.
At present I serialize my object using:
However, I want the file on disk to 'delete on exit' if my application is killed or closes. Like it would if I had done:
FileOutputStream fos = null; ObjectOutputStream out = null; fos = new FileOutputStream(saveFileName); out = new ObjectOutputStream(fos); out.writeObject(myResult); out.close();
So, is it possible to serialize an object in this way?
File myFile = new File("xxxx"); myFile.createTempFile("yyy","zzz"); myFile.deleteOnExit();