You are here

public function ReadableStreamBackupFile::readBytes in Backup and Migrate 5.0.x

Read a line from the file.

Parameters

int $size: The number of bites to read or 0 to read the whole file.

Return value

string The data read from the file or NULL if the file can't be read or is at the end of the file.

Overrides BackupFileReadableInterface::readBytes

File

src/Core/File/ReadableStreamBackupFile.php, line 128

Class

ReadableStreamBackupFile
Uses a readable PHP stream such as a local file.

Namespace

Drupal\backup_migrate\Core\File

Code

public function readBytes($size = 1024, $binary = FALSE) {
  if (!$this
    ->isOpen()) {
    $this
      ->openForRead($binary);
  }
  if ($this->handle && !feof($this->handle)) {
    return fread($this->handle, $size);
  }
  return NULL;
}