createFile

inline fun Path.createFile(vararg attributes: FileAttribute<*>): Path(source)

Creates a new and empty file specified by this path, failing if the file already exists.

Since Kotlin

1.5

Parameters

attributes

an optional list of file attributes to set atomically when creating the file.

See also

Throws

if a file specified by this path already exists (optional specific exception, some implementations may throw more general IOException).

if the attributes array contains an attribute that cannot be set atomically when creating the file.