Here you can find the source of getTempFile(String filePrefix, boolean deleteOnExit)
public static File getTempFile(String filePrefix, boolean deleteOnExit)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.IOException; public class Main { public static File getTempFile(String filePrefix, boolean deleteOnExit) { String tempFileName = filePrefix + "-" + System.nanoTime(); File tempFile = null;//from w w w.ja va2s .com try { tempFile = File.createTempFile(tempFileName, ".txt"); if (deleteOnExit) { tempFile.deleteOnExit(); } } catch (IOException e) { e.printStackTrace(); } return tempFile; } }