createFile

JVM
JRE7
1.4
@ExperimentalPathApi fun Path.createFile(
    vararg attributes: FileAttribute<*>
): Path

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

Parameters

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

Exceptions

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

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

See Also

Files.createFile