/** * fseek() wrapper * * @param integer $offset Offset * @param integer $whence Whence OPTIONAL * * @return boolean */ public function stream_seek($offset, $whence = SEEK_SET) { switch ($whence) { case SEEK_SET: $this->filePosition = $offset; break; case SEEK_CUR: $this->filePosition += $whence; break; case SEEK_END: $this->filePosition = $this->file->getFilesize() + $whence; break; default: } $this->filePosition = max(0, min($this->filePosition, $this->file->getFilesize())); return true; }