File I/O
Read and write files, lines and path operations in Kotlin.
1
kotlin file io
2Read Text File in Kotlin
readText reads entire file content as String. A Kotlin example with source code and sample output.
kotlin file io
3Write Text File in Kotlin
writeText writes string content to a file. A Kotlin example with source code and sample output.
kotlin file io
4Read Lines from File in Kotlin
readLines returns list of lines from a text file. A Kotlin example with source code and sample output.
kotlin file io
5File Exists Check in Kotlin
exists() checks whether file or directory is present. A Kotlin example with source code and sample output.
kotlin file io
6File Path Operations in Kotlin
File class provides name, parent and absolutePath properties. A Kotlin example with source code and sample output.
kotlin file io
use Function for Resources in Kotlin
The use extension closes Closeable resources automatically, even when exceptions occur. A Kotlin example with source code and sample output.