ktor-io / io.ktor.utils.io.bits / kotlin.ByteArray / useMemory

useMemory

expect fun <R> ByteArray.useMemory(offset: Int = 0, length: Int, block: (Memory) -> R): R

TODO KTOR-1673: Solve design problems

  1. length has no default (blocked by expect/actual with default value compiler bug (fixed in KT 1.4.3))
  2. no inline -> can't suspend inside block (blocked by inline compiler bug)