java.io.File类 static File createTempFile(String prefix, String suffix) static File createTempFile(String prefix, String suffix, File directory) Creates an empty file in the default temporary-file directory or in the specified directory, using the given prefix and suffix to generate its name. Invoking this method is equivalent to invoking createTempFile(prefix, suffix, null). Parameters: prefix - The prefix string to be used in generating the file's name; must be at least three characters long suffix - The suffix string to be used in generating the file's name; may be null, in which case the suffix ".tmp" will be used direcotory - The directory in which the file is to be created, or null if the default temporary-file directory is to be used Returns: An abstract pathname denoting a newly-created empty file Throws: IllegalArgumentException - If the prefix argument contains fewer than three characters IOException - If a file could not be created SecurityException - If a security manager exists and its SecurityManager.checkWrite(java.lang.String) method does not allow a file to be created Since: 1.2
static File createTempFile(String prefix, String suffix)
static File createTempFile(String prefix, String suffix, File directory) Creates an empty file in the default temporary-file directory or in the specified directory, using the given prefix and suffix to generate its name. Invoking this method is equivalent to invoking createTempFile(prefix, suffix, null). Parameters:
prefix - The prefix string to be used in generating the file's name; must be at least three characters long
suffix - The suffix string to be used in generating the file's name; may be null, in which case the suffix ".tmp" will be used
direcotory - The directory in which the file is to be created, or null if the default temporary-file directory is to be used Returns:
An abstract pathname denoting a newly-created empty file
Throws:
IllegalArgumentException - If the prefix argument contains fewer than three characters
IOException - If a file could not be created
SecurityException - If a security manager exists and its SecurityManager.checkWrite(java.lang.String) method does not allow a file to be created
Since:
1.2