Flitch\File\File::seek PHP Method

seek() public method

seek(): defined by SeekableIterator interface.
See also: SeekableIterator::seek()
public seek ( integer $position ) : void
$position integer
return void
    public function seek($position)
    {
        $this->rewind();
        $current = 0;
        while ($current < $position) {
            if (!$this->valid()) {
                throw new Exception\OutOfBoundsException('Invalid seek position');
            }
            $this->next();
            $current++;
        }
    }