Files.CreateTempFile Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| CreateTempFile(String, String, IFileAttribute[]) |
Creates an empty file in the default temporary-file directory, using the given prefix and suffix to generate its name. |
| CreateTempFile(IPath, String, String, IFileAttribute[]) |
Creates a new empty file in the specified directory, using the given prefix and suffix strings to generate its name. |
CreateTempFile(String, String, IFileAttribute[])
Creates an empty file in the default temporary-file directory, using the given prefix and suffix to generate its name.
[Android.Runtime.Register("createTempFile", "(Ljava/lang/String;Ljava/lang/String;[Ljava/nio/file/attribute/FileAttribute;)Ljava/nio/file/Path;", "", ApiSince=26)]
public static Java.Nio.FileNio.IPath? CreateTempFile(string? prefix, string? suffix, params Java.Nio.FileNio.Attributes.IFileAttribute[]? attrs);
[<Android.Runtime.Register("createTempFile", "(Ljava/lang/String;Ljava/lang/String;[Ljava/nio/file/attribute/FileAttribute;)Ljava/nio/file/Path;", "", ApiSince=26)>]
static member CreateTempFile : string * string * Java.Nio.FileNio.Attributes.IFileAttribute[] -> Java.Nio.FileNio.IPath
Parameters
- prefix
- String
the prefix string to be used in generating the file's name;
may be null
- suffix
- String
the suffix string to be used in generating the file's name;
may be null, in which case ".tmp" is used
- attrs
- IFileAttribute[]
an optional list of file attributes to set atomically when creating the file
Returns
the path to the newly created file that did not exist before this method was invoked
- Attributes
Remarks
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.
Applies to
CreateTempFile(IPath, String, String, IFileAttribute[])
Creates a new empty file in the specified directory, using the given prefix and suffix strings to generate its name.
[Android.Runtime.Register("createTempFile", "(Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;[Ljava/nio/file/attribute/FileAttribute;)Ljava/nio/file/Path;", "", ApiSince=26)]
public static Java.Nio.FileNio.IPath? CreateTempFile(Java.Nio.FileNio.IPath? dir, string? prefix, string? suffix, params Java.Nio.FileNio.Attributes.IFileAttribute[]? attrs);
[<Android.Runtime.Register("createTempFile", "(Ljava/nio/file/Path;Ljava/lang/String;Ljava/lang/String;[Ljava/nio/file/attribute/FileAttribute;)Ljava/nio/file/Path;", "", ApiSince=26)>]
static member CreateTempFile : Java.Nio.FileNio.IPath * string * string * Java.Nio.FileNio.Attributes.IFileAttribute[] -> Java.Nio.FileNio.IPath
Parameters
- dir
- IPath
the path to directory in which to create the file
- prefix
- String
the prefix string to be used in generating the file's name;
may be null
- suffix
- String
the suffix string to be used in generating the file's name;
may be null, in which case ".tmp" is used
- attrs
- IFileAttribute[]
an optional list of file attributes to set atomically when creating the file
Returns
the path to the newly created file that did not exist before this method was invoked
- Attributes
Exceptions
if the prefix or suffix parameters cannot be used to generate a candidate file name
if the array contains an attribute that cannot be set atomically when creating the directory
if an I/O error occurs or dir does not exist
In the case of the default provider, and a security manager is installed, the checkWrite method is invoked to check write access to the file.
Remarks
Java reference for java.nio.file.Files.createTempFile.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.