in blockmap/src/main/kotlin/com/jetbrains/plugin/blockmap/core/ChunkMerger.kt [37:48]
open fun downloadChunkFromOldData(
oldChunk: Chunk, oldFileRAF: RandomAccessFile, output: OutputStream
) {
oldFileRAF.seek(oldChunk.offset.toLong())
var remainingBytes = oldChunk.length
while (remainingBytes != 0) {
val length = if (remainingBytes >= bufferSize) bufferSize else remainingBytes
oldFileRAF.read(buffer, 0, length)
output.write(buffer, 0, length)
remainingBytes -= length
}
}