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

StringgetTempDirectory(String applicationName)
Returns a temporary directory for a given application
String tempDir = getApplicationDataDirectory(applicationName) + "/temp/";
File tempDirFile = new File(tempDir);
if (!tempDirFile.exists()) {
    tempDirFile.mkdirs();
return tempDirFile.getAbsolutePath() + File.separatorChar;
StringgetTempDirectoryPath()
get Temp Directory Path
return System.getProperty("java.io.tmpdir");
StringgetTempDirectoryPathString()
Getting a string object of the temporal directory which is referrenced by System.getProperty("java.io.tmpdir") .
return System.getProperty("java.io.tmpdir");
StringgetTempDirectoryStr()
Returns the temporary directory as string.
String dir;
File file;
if (m_TempDir == null) {
    dir = System.getProperty(PROPERTY_TMPDIR);
    if (dir == null) {
        dir = System.getProperty("java.io.tmpdir");
    } else {
        file = new File(dir);
...
FilegetTempDirFile()
get Temp Dir File
File dir = new File(getTempDir());
if (!dir.exists() & !dir.mkdir()) {
    return null;
return dir;
StringgetTempDirFilePath(String name)
get Temp Dir File Path
return new File(getTempDirectory(), name).getAbsolutePath();
StringgetTempDirName()
get Temp Dir Name
String tmpDir = System.getProperty("buildDirectory");
if (tmpDir == null) {
    if (new File("target/").exists()) {
        tmpDir = "target";
    } else {
        tmpDir = "/tmp";
return tmpDir;
StringgetTempDirURL()
Get the absolute url of a os specific temp directory
String tempdir = System.getProperty("java.io.tmpdir");
if (!(tempdir.endsWith("/") || tempdir.endsWith("\\"))) {
    tempdir = tempdir + System.getProperty("file.separator");
return tempdir;
StringgetTempDirValue()
Returns with the value of System.getProperty("java.io.tmpdir") .
return checkNotNull(System.getProperty("java.io.tmpdir"), "Null for java.io.tmpdir system property.");
StringgetTempDirWithFileSeparatorSuffix()
Get the platform dependent temporary directory path, with 'file separator' suffix('/' on linux platform, '\' on windows).
String p = System.getProperty("java.io.tmpdir");
if (p.endsWith(File.separator))
    return p;
return p + File.separator;