I\'m looking for a safe way to create a temp file in Java. By safe, I mean the following:
Since Java 7 there is the new file API "NIO2" which contains new methods for creating temnp files and directories. See
e.g.
Path tempDir = Files.createTempDirectory("tempfiles");
or
Path tempFile = Files.createTempFile("tempfiles", ".tmp");