Skip to content

Commit f946266

Browse files
author
Sergey Mashkov
committed
IO: add packet readBytes size parameter
1 parent f64ef93 commit f946266

File tree

1 file changed

+1
-1
lines changed
  • core/kotlinx-coroutines-io/src/main/kotlin/kotlinx/coroutines/experimental/io/packet

1 file changed

+1
-1
lines changed

core/kotlinx-coroutines-io/src/main/kotlin/kotlinx/coroutines/experimental/io/packet/Packets.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ fun ByteReadPacket.readUTF8Line(estimate: Int = 16, limit: Int = Int.MAX_VALUE):
2121
return if (readUTF8LineTo(sb, limit)) sb.toString() else null
2222
}
2323

24-
fun ByteReadPacket.readBytes() = inputStream().readBytes(remaining)
24+
fun ByteReadPacket.readBytes(n: Int = remaining): ByteArray = ByteArray(n).also { readFully(it) }

0 commit comments

Comments
 (0)