Java Temp Directory Get getTempDirectory(Class c)

Here you can find the source of getTempDirectory(Class c)

Description

Returns the temporary directory for the class being tested.

License

artistic-license-2.0

Parameter

Parameter Description
c The class being tested.

Return

the corresponding data directory.

Declaration

public static File getTempDirectory(Class<?> c) 

Method Source Code


//package com.java2s;
/*/*from w  ww  .j  a va2s  . c  om*/
 * This file is part of the DiffX library.
 *
 * For licensing information please see the file license.txt included in the release.
 * A copy of this licence can also be found at 
 *   http://www.opensource.org/licenses/artistic-license-2.0.php
 */

import java.io.File;

public class Main {
    /**
     * Returns the temporary directory for the class being tested.
     * 
     * <p>The temporary directory contains test data that is generated by the test from data can be deleted
     * (eg. generated index, etc...)
     * 
     * @param c The class being tested.
     * @return the corresponding data directory.
     */
    public static File getTempDirectory(Class<?> c) {
        File data = new File("tmp");
        String dir = c.getName().replace('.', File.separatorChar);
        return new File(data, dir);
    }
}

Related

  1. getTempDirectory()
  2. getTempDirectory()
  3. getTempDirectory()
  4. getTempDirectory()
  5. getTempDirectory()
  6. getTempDirectory(String applicationName)
  7. getTempDirectoryPath()
  8. getTempDirectoryPathString()
  9. getTempDirectoryStr()