while (reader.readLine().also { line = it } != null) {
            str.append(line)
        }