blob: 5d790d696ac07cf7385029d0300f4e33b39e72a9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/***************************************************************************
* Copyright (c) 2004 - 2008 Eike Stepper, Germany.
* All rights reserved. This program and the accompanying materials
* are 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:
* Eike Stepper - initial API and implementation
**************************************************************************/
package org.eclipse.net4j.util.io;
import java.io.File;
import java.io.IOException;
/**
* @author Eike Stepper
*/
public final class TMPUtil
{
private TMPUtil()
{
}
public static File createTempFolder() throws IORuntimeException
{
return createTempFolder("tmp");
}
public static File createTempFolder(String prefix) throws IORuntimeException
{
return createTempFolder(prefix, "");
}
public static File createTempFolder(String prefix, String suffix) throws IORuntimeException
{
return createTempFolder(prefix, suffix, null);
}
public static File createTempFolder(String prefix, String suffix, File directory) throws IORuntimeException
{
try
{
File tmp = File.createTempFile(prefix, suffix, directory);
String tmpPath = tmp.getAbsolutePath();
tmp.delete();
tmp = new File(tmpPath);
tmp.mkdirs();
return tmp;
}
catch (IOException ex)
{
throw new IORuntimeException(ex);
}
}
}
|