src/JsonStream.php
private function forward($position)
    {
        $encoder = $this->getEncoder();

        while ($this->cursor < $position) {
            $length = strlen($this->buffer);

            if ($this->cursor + $length > $position) {
                $this->buffer = substr($this->buffer, $position - $this->cursor);
                $this->cursor = $position;
                break;
            }

            $this->cursor += $length;
            $this->buffer = '';

            if (!$encoder->valid()) {
                $this->buffer = null;
                break;
            }

            $this->buffer = $encoder->current();
            $encoder->next();
        }
    }
private function forward($position)
    {
        $encoder = $this->getEncoder();

        while ($this->cursor < $position) {
            $length = strlen($this->buffer);

            if ($this->cursor + $length > $position) {
                $this->buffer = substr($this->buffer, $position - $this->cursor);
                $this->cursor = $position;
                break;
            }

            $this->cursor += $length;
            $this->buffer = '';

            if (!$encoder->valid()) {
                $this->buffer = null;
                break;
            }

            $this->buffer = $encoder->current();
            $encoder->next();
        }
    }
private function forward ( $ position ) { $ encoder = $ this -> getEncoder ( ) ; while ( $ this -> cursor < $ position ) { $ length = strlen ( $ this -> buffer ) ; if ( $ this -> cursor + $ length > $ position ) { $ this -> buffer = substr ( $ this -> buffer , $ position - $ this -> cursor ) ; $ this -> cursor = $ position ; break ; } $ this -> cursor += $ length ; $ this -> buffer = '' ; if ( ! $ encoder -> valid ( ) ) { $ this -> buffer = null ; break ; } $ this -> buffer = $ encoder -> current ( ) ; $ encoder -> next ( ) ; } }
Forwards the JSON stream reading cursor to the given position or to the end of stream.
@param int $position The new position of the cursor
Forwards the JSON stream reading cursor to the given position or to the end of stream .