public class TempFileManager
extends java.lang.Object
File.createTempFile(java.lang.String, java.lang.String)
, this class provides
a static method to create temporary files. The temporary files will be
created in a special directory to be cleaned up the next time this class is
loaded by the JVM. This functionality is required because Win32 platforms
will not allow the JVM to delete files that are open. This causes problems
with items such as JARs that get opened by a URLClassLoader and can therefore
not be deleted by the JVM (including deleteOnExit).
The caller should not need to create an instance of this class, although it
is possible. Simply use the static methods to perform the required
operations. Note that all files created by this class should be considered as
deleted at JVM exit (although the actual deletion may be delayed). If
persistent temporary files are required, use File
instead.
Refer to Sun bugs 4171239 and 4950148 for more details.Constructor and Description |
---|
TempFileManager() |
Modifier and Type | Method and Description |
---|---|
static java.io.File |
createTempFile(java.lang.String prefix,
java.lang.String suffix)
Creates a temporary file in the proper directory to allow for cleanup
after execution.
|
public static java.io.File createTempFile(java.lang.String prefix, java.lang.String suffix) throws java.io.IOException
File.createTempFile(java.lang.String, java.lang.String, java.io.File)
so
refer to it for more documentation. Any file created using this method
should be considered as deleted at JVM exit; therefore, do not use this
method to create files that need to be persistent between application
runs.prefix
- the prefix string used in generating the file name; must be at
least three characters longsuffix
- the suffix string to be used in generating the file's name;
may be null, in which case the suffix ".tmp" will be usedjava.io.IOException
- if a file could not be created
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.