I'm trying to implement RawSource.readAtMostTo using UnsafeBufferOperations.writeToTail.
I want to do
override fun readAtMostTo(sink: Buffer, byteCount: Long): Long {
return UnsafeBufferOperations.writeToTail(sink, 1) { bytes, startIndexInclusive, endIndexExclusive ->
val read: Int = TODO()
read
}.toLong()
}
but writeToTail doesn't give me the Int which I return from the lambda at the callsite in order to do this.