src/JsonStream.php
public function seek($offset, $whence = SEEK_SET)
    {
        $position = $this->calculatePosition($offset, $whence);

        if (!isset($this->cursor) || $position < $this->cursor) {
            $this->getEncoder()->rewind();
            $this->buffer = '';
            $this->cursor = 0;
        }

        $this->forward($position);
    }
public function seek($offset, $whence = SEEK_SET)
    {
        $position = $this->calculatePosition($offset, $whence);

        if (!isset($this->cursor) || $position < $this->cursor) {
            $this->getEncoder()->rewind();
            $this->buffer = '';
            $this->cursor = 0;
        }

        $this->forward($position);
    }
public function seek ( $ offset , $ whence = SEEK_SET ) { $ position = $ this -> calculatePosition ( $ offset , $ whence ) ; if ( ! isset ( $ this -> cursor ) || $ position < $ this -> cursor ) { $ this -> getEncoder ( ) -> rewind ( ) ; $ this -> buffer = '' ; $ this -> cursor = 0 ; } $ this -> forward ( $ position ) ; }
Seeks the given cursor position in the JSON stream.

If the provided seek position is less than the current cursor position, a rewind
operation is performed on the underlying JSON encoder. Whether this works or not
depends on whether the encoded value supports rewinding.

Note that since it's not possible to determine the end of the JSON stream without
encoding the entire value, it's not possible to set the cursor using SEEK_END
constant and doing so will result in an exception.

@param int $offset The offset for the cursor
@param int $whence Either SEEK_CUR or SEEK_SET to determine new cursor position
@throws \RuntimeException If SEEK_END is used to determine the cursor position
Seeks the given cursor position in the JSON stream .