Android Utililty Methods Directory Temp Create

List of utility methods to do Directory Temp Create

Description

The list of methods to do Directory Temp Create are organized into topic(s).

Method

FilecreateTempDir()
create Temp Dir
String lFilename = "tempDir";
File lTempDir = createTempFile(lFilename);
if (!lTempDir.mkdir()) {
    throw new RuntimeException("could not create dir:"
            + lTempDir.getAbsolutePath());
return lTempDir;
FilecreateTempDir(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;
...
FilecreateTempDir(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()) {
...
FilecreateTempDirectory()
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());
...
FilemainTempDir()
main Temp Dir
File dir = new File(tempDir());
dir.mkdirs();
return dir;
Filemktempdir()
Makes a unique temporary directory.
return mktempdir("dir");
Filemktempdir(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);
...
voidsetupTempDir()
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);
...
StringtempDir()
temp Dir
return System.getProperty("java.io.tmpdir") + "/doodleDebug";
FilegetTempDir()
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;