Back to index

php5  5.3.10
Public Member Functions
SeekableIterator Interface Reference

seekable iterator More...

Inheritance diagram for SeekableIterator:
Inheritance graph
Collaboration diagram for SeekableIterator:
Collaboration graph

List of all members.

Public Member Functions

 seek ($index)
 Seek to an absolute position.
 rewind ()
 Rewind the Iterator to the first element.
 current ()
 Return the current element.
 key ()
 Return the key of the current element.
 next ()
 Move forward to next element.
 valid ()
 Check if there is a current element after calls to rewind() or next().

Detailed Description

seekable iterator

Marcus Boerger
PHP 5.0

Turns a normal iterator ino a seekable iterator. When there is a way to seek on an iterator LimitIterator can use this to efficiently rewind to offset.

Definition at line 21 of file

Member Function Documentation

Iterator::current ( ) [inherited]
Iterator::key ( ) [inherited]
Iterator::next ( ) [inherited]
Iterator::rewind ( ) [inherited]
SeekableIterator::seek ( index)

Seek to an absolute position.

$indexposition to seek to

The method should throw an exception if it is not possible to seek to the given position. Typically this exception should be of type OutOfBoundsException.

       function seek($index);
              $position = 0;
              while($position < $index && $this->valid()) {
              if (!$this->valid()) {
                     throw new OutOfBoundsException('Invalid seek position');

Implemented in ArrayIterator, and SplFileObject.

Iterator::valid ( ) [inherited]

The documentation for this interface was generated from the following file: