ApacheLogAnalyzer2Feed
[ class tree: ApacheLogAnalyzer2Feed ] [ index: ApacheLogAnalyzer2Feed ] [ all elements ]

Class: FileIterator

Source Location: /FileIterator.php

Class Overview


Implements an object which iterates over each line in a file.


Implements interfaces:

  • Iterator (internal interface)

Variables

Methods



Class Details

[line 40]
Implements an object which iterates over each line in a file.

Eg:

foreach(new FileIterator('myFile.txt') as $line) { // Do stuff with $line... }

Or:

foreach(new FileIterator('myFile.txt', 2048) as $key => $line) { // Possibly long lines $lineNum = $key + 1;

// Do stuff... }




[ Top ]


Class Variables

$buffer =

[line 53]

Size of read buffer



Tags:

access:  private

Type:   int


[ Top ]

$current =

[line 67]

Current line of file



Tags:

access:  private

Type:   string


[ Top ]

$filename =

[line 46]

Name of file



Tags:

access:  private

Type:   string


[ Top ]

$fp =

[line 60]

File pointer



Tags:

access:  private

Type:   resource


[ Top ]

$key =

[line 74]

Current line number of file



Tags:

access:  private

Type:   int


[ Top ]

$valid =

[line 80]

Whether current element is valid or not



Tags:

access:  private

Type:   mixed


[ Top ]



Class Methods


constructor __construct [line 88]

FileIterator __construct( string $filename, [ $buffer = 1024])

Constructor. Takes the name of the file



Tags:

access:  public


Parameters:

string   $filename   Name of file to go thru
   $buffer  

[ Top ]

method current [line 105]

string current( )

Iterator::current() - Returns the current line of the file.



Tags:

return:  Current line of file
access:  public



Implementation of:
Iterator::current
[ Top ]

method key [line 117]

string key( )

Iterator::key() - Returns the current "key". In this instance, key() + 1 would give you the current line number.



Tags:

return:  Current elements key
access:  public



Implementation of:
Iterator::key
[ Top ]

method next [line 126]

void next( )

Iterator::next() - Advances the iterator to the next "element"



Tags:

access:  public



Implementation of:
Iterator::next
[ Top ]

method rewind [line 144]

void rewind( )

Iterator::rewind() - Resets the iterator to the "beginning"



Tags:

access:  public



Implementation of:
Iterator::rewind
[ Top ]

method valid [line 161]

bool valid( )

Iterator::valid() - Returns true/false as to whether a call to current() is valid/possible or not.



Tags:

return:  Whether current element is valid or not
access:  public



Implementation of:
Iterator::valid
[ Top ]


Documentation generated on Mon, 28 May 2007 16:15:03 +0200 by phpDocumentor 1.3.2