yii\mongodb\file\StreamWrapper::stream_seek PHP Метод

stream_seek() публичный Метод

This method is called in response to fseek().
См. также: fseek()
public stream_seek ( integer $offset, integer $whence = SEEK_SET ) : boolean
$offset integer The stream offset to seek to.
$whence integer Possible values: - SEEK_SET - Set position equal to offset bytes. - SEEK_CUR - Set position to current location plus offset. - SEEK_END - Set position to end-of-file plus offset.
Результат boolean Return true if the position was updated, false otherwise.
    public function stream_seek($offset, $whence = SEEK_SET)
    {
        switch ($whence) {
            case SEEK_SET:
                if ($offset < $this->download->getSize() && $offset >= 0) {
                    $this->pointerOffset = $offset;
                    return true;
                }
                return false;
            case SEEK_CUR:
                if ($offset >= 0) {
                    $this->pointerOffset += $offset;
                    return true;
                }
                return false;
            case SEEK_END:
                if ($this->download->getSize() + $offset >= 0) {
                    $this->pointerOffset = $this->download->getSize() + $offset;
                    return true;
                }
                return false;
            default:
                return false;
        }
    }