Java Random Temp File getRandomTmpFolder()

Here you can find the source of getRandomTmpFolder()

Description

get Random Tmp Folder

License

Open Source License

Declaration

public static File getRandomTmpFolder() 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2011 Red Hat, Inc.// ww w  .  j  a v a  2  s . c  om
 * 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 {
    public static File getRandomTmpFolder() {
        String randomName = String.valueOf(System.currentTimeMillis());
        return new File(getSystemTmpFolder(), randomName);
    }

    public static File getSystemTmpFolder() {
        String tmpFolder = System.getProperty("java.io.tmpdir");
        return new File(tmpFolder);
    }
}

Related

  1. getRandomTempFile()
  2. getRandomTemporaryFolder(String prefix, String suffix)