public function read($length, $offset = null, $cb = null, $pri = EIO_PRI_DEFAULT)
{
$cb = CallbackWrapper::forceWrap($cb);
if (!$this->fd) {
if ($cb) {
$cb($this, false);
}
return false;
}
if (!FileSystem::$supported) {
if ($offset !== null) {
fseek($this->fd, $length);
}
$data = fread($this->fd, $length);
$cb === null || $cb($this, $data);
return $data;
}
$this->offset += $length;
eio_read($this->fd, $length, $offset !== null ? $offset : $this->offset, $pri, $cb, $this);
return true;
}