Java Temp Directory Get getTempDirFilePath(String name)

Here you can find the source of getTempDirFilePath(String name)

Description

get Temp Dir File Path

License

Open Source License

Declaration

public static String getTempDirFilePath(String name) 

Method Source Code

//package com.java2s;
/******************************************************************************* 
 * Copyright (c) 2011 Red Hat, Inc. /*from  w ww  .  jav  a  2  s  . c o  m*/
 * Distributed under license by Red Hat, Inc. All rights reserved. 
 * This program is made available under the terms of the 
 * Eclipse Public License v1.0 which accompanies this distribution, 
 * and is available at http://www.eclipse.org/legal/epl-v10.html 
 * 
 * Contributors: 
 * Red Hat, Inc. - initial API and implementation 
 ******************************************************************************/

import java.io.File;

public class Main {
    private static final String JAVA_IO_TEMP = "java.io.tmpdir";

    public static String getTempDirFilePath(String name) {
        return new File(getTempDirectory(), name).getAbsolutePath();
    }

    public static String getTempDirFilePath() {
        return getTempDirFilePath(createRandomFilename());
    }

    public static String getTempDirectory() {
        return System.getProperty(JAVA_IO_TEMP);
    }

    public static String createRandomFilename() {
        return String.valueOf(System.currentTimeMillis());
    }
}

Related

  1. getTempDirectory(String applicationName)
  2. getTempDirectoryPath()
  3. getTempDirectoryPathString()
  4. getTempDirectoryStr()
  5. getTempDirFile()
  6. getTempDirName()
  7. getTempDirURL()
  8. getTempDirValue()
  9. getTempDirWithFileSeparatorSuffix()