@param int $offset
@param int $whence

@return int

@throws \Icicle\File\Exception\FileException
508045
public function seek(int $offset, int $whence = \SEEK_SET): int
    {
        if (-1 === fseek($this->handle, $offset, $whence)) {
            $message = 'Could not move file pointer.';
            if ($error = error_get_last()) {
                $message .= sprintf(' Errno: %d; %s', $error['type'], $error['message']);
            }
            throw new FileException($message);
        }

        $position = ftell($this->handle);

        if (false === $position) {
            $message = 'Could not get the file pointer position.';
            if ($error = error_get_last()) {
                $message .= sprintf(' Errno: %d; %s', $error['type'], $error['message']);
            }
            throw new FileException($message);
        }

        return $position;
    }
655462
public function move($offset, $whence = SEEK_SET) {
        fseek($this->stream, $offset, $whence);
        return $this;
    }
1262639
public function stream_seek($offset, $whence = SEEK_SET)
    {
        switch ($whence) {
            case SEEK_SET:
                $this->currentlyOpenedFile->position($offset);
                break;
            case SEEK_CUR:
                $this->currentlyOpenedFile->offsetPosition($offset);
                break;
            case SEEK_END:
                $this->currentlyOpenedFile->seekToEnd();
                $this->currentlyOpenedFile->offsetPosition($offset);
        }

        return true;
    }
587386
public function seek(int $offset, int $whence = Seekable::SET)
    {
        switch ($whence) {
            case Seekable::SET:
                $this->position = $offset;
                break;

            case Seekable::CURRENT:
                $this->position += $offset;
                break;

            case Seekable::END:
                $this->position = strlen($this->buffer) + $offset;
                break;

            default:
                throw new \InvalidArgumentException(
                        'Wrong value for $whence, must be one of Seekable::SET,'
                        . ' Seekable::CURRENT or Seekable::END.'
                );
        }
    }
1170620
public function decrement($key, $offset = 1)
    {
        $key = $this->_key($key);

        return wincache_ucache_dec($key, $offset);
    }
868093
protected function incrementInternal($key, $offset = 1, $initial = 0, $expiry = 0)
    {
        if ($this->hasInternal($key)) {
            $oldValue = $this->getInternal($key);
            if (!is_int($oldValue)) {
                throw new UnexpectedValueException(sprintf(
                    'Method increment() requires existing value to be integer, %s found.',
                    gettype($oldValue)
                ));
            }
            $value = $oldValue + $offset;
        } else {
            $value = $initial;
        }
        // setInternal() always returns true without casToken argument.
        $this->setInternal($key, $value, $expiry);
        return $value;
    }
579380
public function fseek( $offset = 0, $whence = SEEK_SET )
    {
        return $this->validHandle() ? fseek( $this->_fileHandle, $offset, $whence ) : false;
    }
221930
public function seek($offset, $whence) {
    if ($whence == SEEK_END) {
      if (isset($this->object_total_length)) {
        $whence = SEEK_SET;
        $offset = $this->object_total_length + $offset;
      } else {
        trigger_error("Unable to seek from end for objects with unknown size",
                      E_USER_WARNING);
        return false;
      }
    }

    if ($whence != SEEK_SET) {
      trigger_error(sprintf("Unsupported seek mode: %d", $whence),
                    E_USER_WARNING);
      return false;
    }
    // If we know the size, then make sure they are only seeking within it.
    if (isset($this->object_total_length) &&
        $offset >= $this->object_total_length) {
      return false;
    }
    if ($offset < 0) {
      return false;
    }
    // Clear EOF and work it out next time they read.
    $this->eof = false;

    // Check if we can seek inside the current buffer
    $block_start = $this->object_block_start_position;
    $buffer_end = $block_start + strlen($this->read_buffer);
    if ($block_start <= $offset && $offset < $buffer_end) {
      $this->buffer_read_position = $offset - $block_start;
    } else {
      $this->read_buffer = "";
      $this->buffer_read_position = 0;
      $this->next_read_position = $offset;
    }
    return true;
  }
348689
public function fileGetContents($offset = -1, $maxlen = null)
	{
		return is_int($maxlen) ? file_get_contents(
			$this->_fhandle,
			$this->use_include_path,
			null,
			$offset,
			$maxlen
		) : file_get_contents(
			$this->_fhandle,
			$this->use_include_path,
			null,
			$offset
		);
	}
920945
public function &offsetGet($offset)
    {
        $pair = $this->lookupKey($offset);

        if ($pair) {
            return $pair->value;
        }

        throw new OutOfBoundsException();
    }
161860
public function seek($offset, $whence = SEEK_SET)
    {
        if (!$this->seekable) {
            throw new \RuntimeException('This AppendStream is not seekable');
        } elseif ($whence !== SEEK_SET) {
            throw new \RuntimeException('The AppendStream can only seek with SEEK_SET');
        }

        $this->pos = $this->current = 0;

        // Rewind each stream
        foreach ($this->streams as $i => $stream) {
            try {
                $stream->rewind();
            } catch (\Exception $e) {
                throw new \RuntimeException('Unable to seek stream '
                    . $i . ' of the AppendStream', 0, $e);
            }
        }

        // Seek to the actual position by reading from each stream
        while ($this->pos < $offset && !$this->eof()) {
            $result = $this->read(min(8096, $offset - $this->pos));
            if ($result === '') {
                break;
            }
        }
    }
634539
public static function getRowsCount(string $path, bool $withHeader = false) : int
    {
        $result = trim(exec("/usr/bin/env wc -l '" . $path . "'", $output, $return));
        if (0 === $return) {
            list($result, ) = explode(' ', $result);
            $result = (int)$result;
            if (0 < $result) {
                $result -= 1;
            }

            return $result;
        }

        $reader = Reader::createFromPath($path, 'r');

        $result = $reader->each(function ($row) {
            return true;
        });

        if (! $withHeader) {
            $result = $result - 1;
        }

        return $result;
    }
1153830
public function offsetGet(int $offset)
    {
        if (!isset($this->list[$offset])) {
            throw new \OutOfRangeException('Offset does not exist');
        }

        return $this->list[$offset];
    }
634123
public function stream_seek($address, $whence = SEEK_SET){
        $this->subprocess_write(self::COMMAND_SEEK, pack('v', $address));

        //This is an assumption that the stream will always seek where its sold - can get some info back if this fails.
        $this->position = $address;
        return true;
    }
318461
function stream_seek($offset, $whence)
    {
        if ($whence == SEEK_SET && $offset >= 0) {
            $this->pos = $offset;
        } elseif ($whence == SEEK_CUR && -$offset <= $this->pos) {
            $this->pos += $offset;
        } elseif ($whence == SEEK_END && -$offset <= sizeof($this->data)) {
            $this->pos = strlen($this->data) + $offset;
        } else {
            return false;
        }
        return true;
    }
254455
public function seek($offset, $whence = SEEK_SET)
    {
        if ($whence == SEEK_SET) {
            $byte = $offset;
        } elseif ($whence == SEEK_CUR) {
            $byte = $offset + $this->ftell();
        } else {
            throw new RuntimeException(__CLASS__ . ' supports only SEEK_SET and SEEK_CUR seek operations');
        }

        // You cannot skip ahead past where you've read from the remote stream
        if ($byte > $this->body->getSize()) {
            throw new RuntimeException(
                "Cannot seek to byte {$byte} when the buffered stream only contains {$this->body->getSize()} bytes"
            );
        }

        return $this->body->seek($byte);
    }
922024
public function stream_seek(int $offset, int $whence = SEEK_SET): bool
    {
        return 0 === fseek($this->filePointer, $offset, $whence);
    }