in util-core/src/main/scala/com/twitter/io/Buf.scala [509:543]
def process(from: Int, until: Int, processor: Processor): Int = {
checkSliceArgs(from, until)
if (this.isSliceEmpty(from, until)) return -1
var i = 0
var bufIdx = 0
var continue = true
while (continue && i < until && bufIdx < bufs.length) {
val buf = bufs(bufIdx)
val bufLen = buf.length
if (i + bufLen < from) {
// skip ahead to the right Buf for `from`
bufIdx += 1
i += bufLen
} else {
// ensure we are positioned correctly in the first Buf
var byteIdx =
if (i >= from) 0
else from - i
val endAt = math.min(bufLen, until - i)
while (continue && byteIdx < endAt) {
val byte = buf.get(byteIdx)
if (processor(byte)) {
byteIdx += 1
} else {
continue = false
}
}
bufIdx += 1
i += byteIdx
}
}
if (continue) -1
else i
}