List of utility methods to do Directory Temp Create
File | createTempDir() create Temp Dir String lFilename = "tempDir"; File lTempDir = createTempFile(lFilename); if (!lTempDir.mkdir()) { throw new RuntimeException("could not create dir:" + lTempDir.getAbsolutePath()); return lTempDir; |
File | createTempDir(String dirname) create Temp Dir File tmpDirectory = File.createTempFile(dirname, ".tmp"); tmpDirectory.delete(); if (!tmpDirectory.mkdir()) { throw new IOException("Could not create tmp directory: " + tmpDirectory.getPath()); tmpDirectory.deleteOnExit(); return tmpDirectory; ... |
File | createTempDir(final String prefix, final String suffix) Creates temporary directory. File retVal = null; java.util.Random random = new java.util.Random( System.currentTimeMillis()); int retry = 0; while ((null == retVal) && retry < 20) { retVal = new File(System.getProperty("java.io.tmpdir") + File.separator + prefix + random.nextInt() + suffix); if (!retVal.mkdir()) { ... |
File | createTempDirectory() create Temp Directory File dir = File.createTempFile("temp", Long.toString(System.nanoTime())); if (!(dir.delete())) throw new IOException("Could not delete temp file: " + dir.getAbsolutePath()); if (!(dir.mkdir())) throw new IOException("Could not create temp directory: " + dir.getAbsolutePath()); ... |
File | mainTempDir() main Temp Dir File dir = new File(tempDir()); dir.mkdirs(); return dir; |
File | mktempdir() Makes a unique temporary directory. return mktempdir("dir"); |
File | mktempdir(String filePrefix) mktempdir File tmpdir = File.createTempFile(filePrefix, ".tmp", baseDir); boolean status = tmpdir.delete(); if (!status) { throw new IOException("failed to delete tmp file"); status = tmpdir.mkdir(); if (!status) { throw new IOException("failed to made tmp dir " + tmpdir); ... |
void | setupTempDir() package visible for testability String baseDirStr = System.getenv("FLUME_TMP_DIR"); if (baseDirStr == null || baseDirStr.equals("")) { String dateFmt = "yyyyMMdd-HHmmssSSSZ"; SimpleDateFormat sdf = new SimpleDateFormat(dateFmt); baseDirStr = "flume-" + sdf.format(new Date(Clock.unixTime())); File tmpDir = new File(System.getProperty("java.io.tmpdir")); baseDir = new File(tmpDir, baseDirStr); ... |
String | tempDir() temp Dir return System.getProperty("java.io.tmpdir") + "/doodleDebug"; |
File | getTempDir() get Temp Dir File ext = Environment.getExternalStorageDirectory(); File tempDir = new File(ext, "asdf/temp"); tempDir.mkdirs(); if (!tempDir.exists() || !tempDir.canWrite()) { return null; return tempDir; |