Question - What are the names of some extension methods that Kotlin provides to java.io.File?
Answer -
Following are some extension methods that Kotlin provides to java.io.File:
- bufferedReader(): It is used for reading the contents of a file into BufferedReader.
- readBytes(): It is used for reading the contents of the file to ByteArray.
- readText(): It is used for reading contents of the file to a single String.
- forEachLine(): It is used for reading a file line by line in Kotlin.
- readLines(): It is used for reading lines in the file to List.