createFile

JVM
JRE7
1.5
fun Path.createFile(
    vararg attributes: FileAttribute<*>
): Path

(source)

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