Java Temp Directory Get getTempDir(File baseDir)

Here you can find the source of getTempDir(File baseDir)

Description

get Temp Dir

License

Open Source License

Declaration

public static File getTempDir(File baseDir) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.util.UUID;

public class Main {
    public static File getTempDir() {
        return getTempDir(null);
    }/*from w w  w.j  a  va 2 s.com*/

    public static File getTempDir(File baseDir) {
        File dir = null;
        while (dir == null) {
            if (baseDir != null) {
                dir = new File(baseDir, UUID.randomUUID().toString());
            } else {
                dir = new File(UUID.randomUUID().toString());
            }
            if (dir.exists()) {
                dir = null;
            }
        }
        return dir;
    }
}

Related

  1. getTempDir()
  2. getTempDir()
  3. getTempDir()
  4. getTempDir()
  5. getTempDir()
  6. getTempDir(final String directory, final String prefix, boolean autodelete)
  7. getTempDir(Object fileID, String fileName)
  8. getTempDir(String desc)
  9. getTempDir(String name, String prefix, File parentDir)