2 ms·
Most likely: in.buffered.readText() The Kotlin stdlib has a rich set of extension methods for reading in whole files of various common formats at once. rea
by nostrademons 10y ago
Most likely:
in.buffered.readText()
The Kotlin stdlib has a rich set of extension methods for reading in whole files of various common formats at once. readText() reads it all into memory at once. readLines() reads it into a list of Lines. forEachLine{} runs a closure on each line. useLines reads it into a sequence (a lazily-evaluated collection) and then passes that into a closure. buffered converts it to a BufferedReader, basically wrapping it in your buffering loop. inputStream converts it to an InputStream, reader to a Reader, and most common Java protocol libraries take one of those two, so if you need something more complicated you just pass that in.
I've yet to write an input loop in Kotlin.