Открыть боковую панель
Aurora OS
Kotlin Multiplatform
Libraries
ktor
Коммиты
55106bcd
Не подтверждена
Коммит
55106bcd
создал
Янв 30, 2025
по автору
Bruce Hamilton
Зафиксировано автором
GitHub
Янв 30, 2025
Просмотр файлов
KTOR-8051 Revert EOFException change (#4627)
владелец
1c4f5b9a
Изменения
1
Скрыть пробелы
Построчно
Рядом
ktor-io/common/src/io/ktor/utils/io/ByteReadChannelOperations.kt
Просмотр файла @
55106bcd
...
@@ -460,9 +460,11 @@ public val ByteReadChannel.availableForRead: Int
...
@@ -460,9 +460,11 @@ public val ByteReadChannel.availableForRead: Int
*/
*/
@OptIn
(
InternalAPI
::
class
)
@OptIn
(
InternalAPI
::
class
)
public
suspend
fun
ByteReadChannel
.
readFully
(
out
:
ByteArray
,
start
:
Int
=
0
,
end
:
Int
=
out
.
size
)
{
public
suspend
fun
ByteReadChannel
.
readFully
(
out
:
ByteArray
,
start
:
Int
=
0
,
end
:
Int
=
out
.
size
)
{
if
(
end
>
start
&&
isClosedForRead
)
throw
EOFException
(
"Channel is already closed"
)
var
offset
=
start
var
offset
=
start
while
(
offset
<
end
)
{
while
(
offset
<
end
)
{
if
(
readBuffer
.
exhausted
())
awaitContent
()
if
(
readBuffer
.
exhausted
())
awaitContent
()
if
(
isClosedForRead
)
throw
EOFException
(
"Channel is already closed"
)
val
count
=
min
(
end
-
offset
,
readBuffer
.
remaining
.
toInt
())
val
count
=
min
(
end
-
offset
,
readBuffer
.
remaining
.
toInt
())
readBuffer
.
readTo
(
out
,
offset
,
offset
+
count
)
readBuffer
.
readTo
(
out
,
offset
,
offset
+
count
)
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать