public function read($length) { $this->assertAttached(); $result = $this->stream->read($length); if ($result === false) { throw new \RuntimeException('An error occurred during the read operation.'); } return $result; }