Here you can find the source of createTempFile(Path baseDir, String prefix, String suffix)
public static Path createTempFile(Path baseDir, String prefix, String suffix) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; public class Main { public static Path createTempFile(Path baseDir, String prefix, String suffix) throws IOException { Path tmp = Files.createTempFile(baseDir, prefix, suffix); tmp.toFile().deleteOnExit();//ww w. j a v a 2 s . c om return tmp; } public static Path createTempFile(String prefix, String suffix) throws IOException { Path tmp = Files.createTempFile(prefix, suffix); tmp.toFile().deleteOnExit(); return tmp; } }