How to return and delete file?

I want to return file (read or load) from method and then remove this file. public File method() { File f = loadFile(); f.delete(); return f; } But when I delete a file, I delete it f...