kotlin小知识点--while ((len = inputString.read(buffer)) != -1) kotlin中写法

#java 读取流java写法

while ((len = inputString.read(buffer)) != -1) {
         out.write(buffer, 0,len);
}
#kotlin 读取流kotlin写法

var len = -1
while (((inputString.read(b)).also { len = it }) != -1) {
     fos.write(b,0,len)
}

你可能感兴趣的:(kotlin小知识点--while ((len = inputString.read(buffer)) != -1) kotlin中写法)