You are here

protected function LargeFileContent::doRead in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/content/LargeFileContent.php \org\bovigo\vfs\content\LargeFileContent::doRead()

actual reading of given byte count starting at given offset

Parameters

int $offset:

int $count:

Overrides SeekableFileContent::doRead

1 call to LargeFileContent::doRead()
LargeFileContent::content in vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/content/LargeFileContent.php
returns actual content

File

vendor/mikey179/vfsStream/src/main/php/org/bovigo/vfs/content/LargeFileContent.php, line 109

Class

LargeFileContent
File content implementation to mock large files.

Namespace

org\bovigo\vfs\content

Code

protected function doRead($offset, $count) {
  if ($offset + $count > $this->size) {
    $count = $this->size - $offset;
  }
  $result = '';
  for ($i = 0; $i < $count; $i++) {
    if (isset($this->content[$i + $offset])) {
      $result .= $this->content[$i + $offset];
    }
    else {
      $result .= ' ';
    }
  }
  return $result;
}