|
Wikibase
MediaWiki Wikibase extension
|
LineReader allows iterating over the lines of a file. More...
Inheritance diagram for Wikibase\Repo\IO\LineReader:
Collaboration diagram for Wikibase\Repo\IO\LineReader: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. | |
| __destruct () | |
| Destructor, calls dispose() if $autoDispose was set in the constructor. | |
| current () | |
| Return the current line. | |
| next () | |
| Reads the next line. | |
| key () | |
| Return the current line number. | |
| valid () | |
| Checks if current position is valid. | |
| rewind () | |
| Sets the file pointer to the beginning of the file, if supported. | |
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 ) |
| resource | $fileHandle | The file to read from. |
| bool | $canClose | Whether calling dispose() should close the fine handle. |
| bool | $autoDispose | Whether to automatically call dispose() when reaching EOF or when this reader is destructed. |
| InvalidArgumentException |
| 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 |