List of utility methods to do Temp Directory Create
File | createTempDir() Create a temporary directory. File baseDir = getTempDirectory(); try { return Files.createTempDirectory(baseDir.toPath(), "tmpdir").toFile(); } catch (IOException e) { throw new IllegalStateException("Error while creating temporary directory", e); |
File | createTempDir() Guava's method, moved here to avoid a huge dependency TODO: maybe switch to JDK 7 to use its java.nio.file.Files#createTempDirectory() return getTempDir(System.currentTimeMillis() + ""); |
Path | createTempDir(final String prefix) create Temp Dir try { return Files.createTempDirectory(prefix); } catch (IOException ex) { ex.printStackTrace(); return null; |
File | createTempDir(String prefix) create Temp Dir return createTempDir(new File(System.getProperty("java.io.tmpdir")), prefix); |
Path | createTempDir(String subdirectory) create Temp Dir String systemTmpDir = System.getProperty("java.io.tmpdir"); Path tempDirPath = Paths.get(systemTmpDir, subdirectory); if (Files.notExists(tempDirPath)) { return Files.createDirectory(tempDirPath); } else { return tempDirPath; |
File | createTempDir(String suffix) create Temp Dir mkdirs(TMP); File tmpFile = File.createTempFile("tmpdir-", suffix, TMP); deleteFile(tmpFile); mkdirs(tmpFile); return tmpFile; |
Path | createTempDirectory() Creates a new temp directory in the java temp folder. final File parent = new File(getTempDirValue()); if (!parent.exists() || !parent.canWrite()) { throw new RuntimeException("Cannot access temporary directory under: " + getTempDirValue()); File child; try { child = Files.createTempDirectory(parent.toPath(), null).toFile(); } catch (IOException e) { ... |
File | createTempDirectory() create Temp Directory try { final File directory = Files.createTempDirectory("sqs").toFile(); directory.deleteOnExit(); return directory; } catch (IOException e) { throw Throwables.propagate(e); |
File | createTempDirectory() create Temp Directory final File temp; temp = Files.createTempDirectory("advtmp").toFile(); return temp; |
File | createTempDirectory(File parent, String prefix) Create temporary directory and use specified parent. if (parent == null) { parent = new File(System.getProperty("java.io.tmpdir")); return Files.createTempDirectory(parent.toPath(), prefix).toFile(); |