long length = section.right - section.left;
long bytesTransferred = 0;
while (bytesTransferred < length)
{
long toTransfer = Math.min(CHUNK_SIZE, length - bytesTransferred);
long lastWrite = fc.transferTo(section.left + bytesTransferred, toTransfer, channel);
bytesTransferred += lastWrite;
header.file.progress += lastWrite;
}
if (logger.isDebugEnabled())
logger.debug("Bytes transferred " + bytesTransferred + "/" + header.file.size);