createTempFile
@ExperimentalPathApi fun createTempFile(
prefix: String? = null,
suffix: String? = null,
vararg attributes: FileAttribute<*>
): Path
Creates an empty file in the default temp directory, using the given prefix and suffix to generate its name.
Parameters
attributes
- an optional list of file attributes to set atomically when creating the file.
Exceptions
UnsupportedOperationException
- if the array contains an attribute that cannot be set atomically
when creating the file.
Return the path to the newly created file that did not exist before.
See Also
@ExperimentalPathApi fun createTempFile(
directory: Path?,
prefix: String? = null,
suffix: String? = null,
vararg attributes: FileAttribute<*>
): Path
Creates an empty file in the specified directory, using the given prefix and suffix to generate its name.
Parameters
directory
- the parent directory in which to create a new file.
It can be null
, in that case the new file is created in the default temp directory.
attributes
- an optional list of file attributes to set atomically when creating the file.
Exceptions
UnsupportedOperationException
- if the array contains an attribute that cannot be set atomically
when creating the file.
Return the path to the newly created file that did not exist before.
See Also