Package adams.core.io
Class TempUtils
- java.lang.Object
-
- adams.core.io.TempUtils
-
public class TempUtils extends Object
Functionality related to temporary directory and temporary files.
The temp directory can be overridden using thePROPERTY_TMPDIR
property.- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
m_TempDir
the temporary directory.static String
PROPERTY_TMPDIR
property indicating the temp directory to use.
-
Constructor Summary
Constructors Constructor Description TempUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static File
createTempFile(PlaceholderDirectory dir, String prefix, String suffix)
Creates a temp file name in the specified directory.static File
createTempFile(String file)
Assembles a temp file in the user's temp directory.static File
createTempFile(String prefix, String suffix)
Creates a temp file name in the user's temp directory.static File
getTempDirectory()
Returns the temporary directory.static String
getTempDirectoryStr()
Returns the temporary directory as string.
-
-
-
Field Detail
-
PROPERTY_TMPDIR
public static final String PROPERTY_TMPDIR
property indicating the temp directory to use.- See Also:
- Constant Field Values
-
m_TempDir
protected static String m_TempDir
the temporary directory.
-
-
Method Detail
-
createTempFile
public static File createTempFile(PlaceholderDirectory dir, String prefix, String suffix)
Creates a temp file name in the specified directory.- Parameters:
dir
- the directory for the temp file, use null for user's temp dirprefix
- the prefix for the name, can be nullsuffix
- the suffix, eg the extension (must incl dot), can be null- Returns:
- the generated file name
-
createTempFile
public static File createTempFile(String prefix, String suffix)
Creates a temp file name in the user's temp directory.- Parameters:
prefix
- the prefix for the name, can be nullsuffix
- the suffix, eg the extension (must incl dot), can be null- Returns:
- the generated file name
-
createTempFile
public static File createTempFile(String file)
Assembles a temp file in the user's temp directory.- Parameters:
file
- the file (w/o path) to place in the temp directory- Returns:
- the generated file name
-
getTempDirectoryStr
public static String getTempDirectoryStr()
Returns the temporary directory as string.- Returns:
- the temp directory
-
getTempDirectory
public static File getTempDirectory()
Returns the temporary directory.- Returns:
- the temp directory
-
-