Aerys\Root::sendSingleRange PHP Method

sendSingleRange() private method

private sendSingleRange ( Amp\File\Handle $handle, aerys\Response $response, integer $startPos, integer $endPos ) : Generator
$handle Amp\File\Handle
$response aerys\Response
$startPos integer
$endPos integer
return Generator
    private function sendSingleRange(file\Handle $handle, Response $response, int $startPos, int $endPos) : \Generator
    {
        $bytesRemaining = $endPos - $startPos + 1;
        (yield $handle->seek($startPos));
        while ($bytesRemaining) {
            $toBuffer = $bytesRemaining > 8192 ? 8192 : $bytesRemaining;
            $chunk = (yield $handle->read($toBuffer));
            $bytesRemaining -= \strlen($chunk);
            (yield $response->stream($chunk));
        }
    }