Here you can find the source of createTemporaryFile(String extension)
static File createTemporaryFile(String extension)
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.io.File; import java.nio.file.Path; import java.nio.file.Paths; import java.util.LinkedList; import java.util.UUID; public class Main { private static final LinkedList<File> tempFiles = new LinkedList<>(); static File createTemporaryFile(File basePath, String extension) { Path p = basePath == null ? Paths.get(System.getProperty("java.io.tmpdir"), "soundclip-" + UUID.randomUUID().toString() + extension) : Paths.get(basePath.getAbsolutePath(), "soundclip-" + UUID.randomUUID().toString() + extension); File f = p.toFile();/* w ww . j a va 2s . c om*/ tempFiles.add(f); return f; } static File createTemporaryFile(String extension) { return createTemporaryFile(null, extension); } }