gpt4 book ai didi

android - 如何在 kotlin android 中使用 responseInputStream.read 编写 while 循环 - - while ((i = responseInputStream.read(byteContainer))

转载 作者:太空宇宙 更新时间:2023-11-03 13:11:05 25 4
gpt4 key购买 nike

<分区>

如何在 kotlin android 中使用 while 循环和 responseInputStream.read

my code for while loop in kotlin android

another one

这里添加了responseInputStream read while loop .kt

                val responseInputStream = conn.inputStream
val responseStringBuffer = StringBuffer()
val byteContainer = ByteArray(1024)
var i: Int
while ((i = responseInputStream.read(byteContainer)) != -1) {
responseStringBuffer.append(String(byteContainer, 0, i))
}
Log.w("TAG", "res :" + responseStringBuffer.toString())

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com