Java Temp Folder Create getTempPath()

Here you can find the source of getTempPath()

Description

Create a temporary filename (for use as a file or directory)

License

Apache License

Declaration

public static String getTempPath() 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.File;
import java.io.IOException;

public class Main {
    /**/*  w  ww .  ja v  a  2  s  .co m*/
     * Create a temporary filename (for use as a file or directory)
     *
     * @return
     */
    public static String getTempPath() {
        return getTempPath("ee-");
    }

    /**
     * Create a temporary filename with the given prefix (for use as a file or directory)
     *
     * @param prefix
     * @return
     */
    public static String getTempPath(String prefix) {
        try {
            File temp = File.createTempFile("ee-", "");
            temp.delete();
            return temp.getPath();
        } catch (IOException e) {
        }
        return null;
    }
}

Related

  1. getTempPath()
  2. getTempPath()
  3. getTempPath()
  4. getTempPath()
  5. GetTempPath()
  6. getTempPath()
  7. getTempPath()
  8. getTempPath()