Java Random Temp File getRandomTemporaryFolder(String prefix, String suffix)

Here you can find the source of getRandomTemporaryFolder(String prefix, String suffix)

Description

get Random Temporary Folder

License

Open Source License

Return

A random temporary folder that can be used for file-system operations testing

Declaration

public static File getRandomTemporaryFolder(String prefix, String suffix) 

Method Source Code

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

import com.google.common.base.Strings;
import java.io.File;

import java.util.UUID;

public class Main {
    /** @return A random temporary folder that can be used for file-system operations testing */
    public static File getRandomTemporaryFolder(String prefix, String suffix) {
        return new File(System.getProperty("java.io.tmpdir"),
                Strings.nullToEmpty(prefix) + UUID.randomUUID().toString() + Strings.nullToEmpty(suffix));
    }/*from w w w.j av a2 s. c  om*/
}

Related

  1. getRandomTempFile()
  2. getRandomTmpFolder()