readUntilDelimiter

suspend fun ByteReadChannel.readUntilDelimiter(delimiter: ByteBuffer, dst: ByteBuffer): Int

Reads from the channel to the specified dst byte buffer until one of the following:

  • channel's end

  • dst capacity exceeded

  • delimiter bytes encountered

If delimiter bytes encountered then these bytes remain unconsumed

Return

non-negative number of copied bytes, possibly 0