readText

JVM
JRE7
1.5
fun Path.readText(charset: Charset = Charsets.UTF_8): String
(source)

Gets the entire content of this file as a String using UTF-8 or the specified charset.

It's not recommended to use this function on huge files. For reading large files or files of unknown size, open a Reader and read blocks of text sequentially.

Parameters

charset - character set to use for reading text, UTF-8 by default.

Return the entire content of this file as a String.