Java Utililty Methods Temp Directory Get

List of utility methods to do Temp Directory Get

Description

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

Method

FilegetTempDir(String desc)
Returns temp dir, containing String arg in its name; does not create the directory.
String tempDir = System.getProperty("java.io.tmpdir");
if (tempDir == null)
    throw new RuntimeException("java.io.tmpdir undefined, cannot run test");
return new File(tempDir, desc + "." + new Random().nextLong());
FilegetTempDir(String name, String prefix, File parentDir)
Returns An abstract pathname denoting an empty directory (this directory is not created).
prefix = prefix == null ? "ejpt" : prefix;
parentDir = parentDir != null ? parentDir : new File(System.getProperty("java.io.tmpdir"));
if (name == null) {
    try {
        File temp = File.createTempFile(prefix, "");
        name = temp.getName();
        temp.delete();
    } catch (IOException ex) {
...
FilegetTempDir(String path)
get Temp Dir
File tempdir = new File(System.getProperty("java.io.tmpdir"), path);
tempdir.mkdirs();
return tempdir;
FilegetTempDir(String prefix)
get Temp Dir
String baseTempDir = System.getProperty("java.io.tmpdir");
File tempDir = new File(baseTempDir, prefix + "-temp");
File result = connonicalize(tempDir);
result.deleteOnExit();
return result;
FilegetTempDir(String suffix)
Returns a File pointing to a temporary directory.
String temp = System.getProperty("java.io.tmpdir");
if (temp == null) {
    temp = "tmp";
if (suffix == null) {
    return new File(temp);
} else {
    return new File(temp, suffix);
...
java.io.FilegetTempDirectory()
get Temp Directory
return tempDirectory;
StringgetTempDirectory()
get Temp Directory
String tempDir = System.getProperty("java.io.tmpdir");
if (tempDir != null) {
    tempDir = tempDir.replace('\\', '/');
return tempDir;
FilegetTempDirectory()
get Temp Directory
final File tempDirectory = new File(System.getProperty("java.io.tmpdir"), "gluster-test-mount-point");
if (!tempCreated) {
    tempDirectory.mkdirs();
    tempDirectory.delete();
    tempDirectory.mkdir();
tempCreated = true;
return tempDirectory;
...
StringgetTempDirectory()
Return the directory where temporary files are created.
String tempDirectory = System.getProperty("java.io.tmpdir"); 
if (tempDirectory != null) {
    return tempDirectory;
File f = File.createTempFile("directory-finder", ".tmp"); 
f.delete();
return f.getParent();
FilegetTempDirectory()
Returns the java.io.tmpdir property.
return new File(System.getProperty("java.io.tmpdir"));