List of utility methods to do Random Temp File
File | getRandomTempFile() get Random Temp File String tempName = UUID.randomUUID().toString().replaceAll("-", ""); File tempFile = new File(System.getProperty(JAVA_IO_TMP_DIR) + tempName + ".tmp"); if (!tempFile.createNewFile()) { throw new IOException("Can not create temp file :" + tempFile.getParent()); return tempFile; |
File | getRandomTemporaryFolder(String prefix, String suffix) get Random Temporary Folder return new File(System.getProperty("java.io.tmpdir"), Strings.nullToEmpty(prefix) + UUID.randomUUID().toString() + Strings.nullToEmpty(suffix)); |
File | getRandomTmpFolder() get Random Tmp Folder String randomName = String.valueOf(System.currentTimeMillis()); return new File(getSystemTmpFolder(), randomName); |