class FileInputStream in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/masterminds/html5/src/HTML5/Parser/FileInputStream.php \Masterminds\HTML5\Parser\FileInputStream
The FileInputStream loads a file to be parsed.
So right now we read files into strings and then process the string. We chose to do this largely for the sake of expediency of development, and also because we could optimize toward processing arbitrarily large chunks of the input. But in the future, we'd really like to rewrite this class to efficiently handle lower level stream reads (and thus efficiently handle large documents).
@todo A buffered input stream would be useful.
Hierarchy
- class \Masterminds\HTML5\Parser\StringInputStream implements InputStream
- class \Masterminds\HTML5\Parser\FileInputStream implements InputStream
Expanded class hierarchy of FileInputStream
2 files declare their use of FileInputStream
- FileInputStreamTest.php in vendor/
masterminds/ html5/ test/ HTML5/ Parser/ FileInputStreamTest.php - HTML5.php in vendor/
masterminds/ html5/ src/ HTML5.php
File
- vendor/
masterminds/ html5/ src/ HTML5/ Parser/ FileInputStream.php, line 16
Namespace
Masterminds\HTML5\ParserView source
class FileInputStream extends StringInputStream implements InputStream {
/**
* Load a file input stream.
*
* @param string $data
* The file or url path to load.
*/
public function __construct($data, $encoding = 'UTF-8', $debug = '') {
// Get the contents of the file.
$content = file_get_contents($data);
parent::__construct($content, $encoding, $debug);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FileInputStream:: |
public | function |
Load a file input stream. Overrides StringInputStream:: |
|
StringInputStream:: |
private | property | The current integer byte position we are in $data | |
StringInputStream:: |
private | property | The string data we're parsing. | |
StringInputStream:: |
private | property | Length of $data; when $char === $data, we are at the end-of-file. | |
StringInputStream:: |
public | property | Parse errors. | |
StringInputStream:: |
public | function |
Read to a particular match (or until $max bytes are consumed). Overrides InputStream:: |
|
StringInputStream:: |
public | function |
Returns the string so long as $bytes matches. Overrides InputStream:: |
|
StringInputStream:: |
public | function |
Returns the current column of the current line that the tokenizer is at. Overrides InputStream:: |
|
StringInputStream:: |
public | function | Get the current character. | |
StringInputStream:: |
public | function |
Returns the current line that the tokenizer is at. Overrides InputStream:: |
|
StringInputStream:: |
public | function | ||
StringInputStream:: |
public | function | ||
StringInputStream:: |
public | function | ||
StringInputStream:: |
public | function | Advance the pointer. This is part of the Iterator interface. | |
StringInputStream:: |
public | function |
Look ahead without moving cursor. Overrides InputStream:: |
|
StringInputStream:: |
public | function |
Get all characters until EOF. Overrides InputStream:: |
|
StringInputStream:: |
protected | function | Replace linefeed characters according to the spec. | |
StringInputStream:: |
public | function | Rewind to the start of the string. | |
StringInputStream:: |
public | function |
Unconsume characters. Overrides InputStream:: |
|
StringInputStream:: |
public | function | Is the current pointer location valid. |