Swift_ByteStream_FileByteStream::_seekReadStreamToPosition PHP Method

_seekReadStreamToPosition() private method

Streams in a readOnly stream ensuring copy if needed
private _seekReadStreamToPosition ( $offset )
    private function _seekReadStreamToPosition($offset)
    {
        if ($this->_seekable === null) {
            $this->_getReadStreamSeekableStatus();
        }
        if ($this->_seekable === false) {
            $currentPos = ftell($this->_reader);
            if ($currentPos < $offset) {
                $toDiscard = $offset - $currentPos;
                fread($this->_reader, $toDiscard);
                return;
            }
            $this->_copyReadStream();
        }
        fseek($this->_reader, $offset, SEEK_SET);
    }