lundi 2 mars 2015

Alternative to File.deleteOnExit() in Java NIO?



Java IO has File.deleteOnExit(), which is a method that deletes the file it is called on during normal termination of the JVM. I've found this to be very useful for cleaning up temporary files, especially during unit tests.


However, I don't see a method by the same name in Java NIO's Files class. I am aware that I can do path.toFile().deleteOnExit(), but I'd like to know if there is an alternative using NIO.


Is there an alternative? If not, why is there not one?




Aucun commentaire:

Enregistrer un commentaire