Wikibase
MediaWiki Wikibase extension
|
LineReader allows iterating over the lines of a file. More...
Public Member Functions | |
__construct ( $fileHandle, $canClose=true, $autoDispose=false) | |
dispose () | |
Closes the underlying file handle if the $canClose parameter was given as true (the default) in the constructor. More... | |
__destruct () | |
Destructor, calls dispose() if $autoDispose was set in the constructor. More... | |
current () | |
Return the current line. More... | |
next () | |
Reads the next line. More... | |
key () | |
Return the current line number. More... | |
valid () | |
Checks if current position is valid. More... | |
rewind () | |
Sets the file pointer to the beginning of the file, if supported. More... | |
Private Attributes | |
$fileHandle | |
$canClose | |
$autoDispose | |
$current = null | |
$line = 0 | |
LineReader allows iterating over the lines of a file.
Each line returned will contain the line separator character(s) and all whitespace. Concatenating all lines returned by the reader should result in the original file.
Wikibase\Repo\IO\LineReader::__construct | ( | $fileHandle, | |
$canClose = true , |
|||
$autoDispose = false |
|||
) |
Wikibase\Repo\IO\LineReader::__destruct | ( | ) |
Destructor, calls dispose() if $autoDispose was set in the constructor.
Wikibase\Repo\IO\LineReader::current | ( | ) |
Wikibase\Repo\IO\LineReader::dispose | ( | ) |
Closes the underlying file handle if the $canClose parameter was given as true (the default) in the constructor.
Wikibase\Repo\IO\LineReader::key | ( | ) |
Wikibase\Repo\IO\LineReader::next | ( | ) |
Reads the next line.
Use current() to get the line's content.
Wikibase\Repo\IO\LineReader::rewind | ( | ) |
Sets the file pointer to the beginning of the file, if supported.
Has no effect if this LineReader has already been disposed.
Wikibase\Repo\IO\LineReader::valid | ( | ) |
Checks if current position is valid.
Returns true if and only if next() has been called at least once and the end of file has not yet been reached.
|
private |
|
private |
|
private |
|
private |
|
private |