I read on SO and converted to this ``` while (`in`...
# announcements
k
I read on SO and converted to this
Copy code
while (`in`!!.readLine() != null) {
                line = `in`!!.readLine()
                outputText += line
            }
g
Why not just:
Copy code
val input: InputStream = ...
val outputText = input.bufferedReader().readText()
Or you want to process each line:
Copy code
val input: InputStream = ...
input.bufferedReader().forEachLine { line ->
//Do something with line
}
The only thing don’t forget to close input or reader. Just wrap to
input.use{}
for the first case (don’t required for the second case)
c
@kantsu also you're processing every next line, not each line, the lines read in the while condition are thrown out
1