var c: Int; while ((c = reader.read()) != 1) { }
您必须将其重写为:
while (true) { val c = reader.read() if (c == 1) break ... }