createFile
Platform and version requirements: JVM (1.5), JRE7 (1.5)
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
© 2010–2021 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io.path/java.nio.file.-path/create-file.html