2 namespace Masterminds\HTML5\Parser;
5 * The FileInputStream loads a file to be parsed.
7 * So right now we read files into strings and then process the
8 * string. We chose to do this largely for the sake of expediency of
9 * development, and also because we could optimize toward processing
10 * arbitrarily large chunks of the input. But in the future, we'd
11 * really like to rewrite this class to efficiently handle lower level
12 * stream reads (and thus efficiently handle large documents).
14 * @todo A buffered input stream would be useful.
16 class FileInputStream extends StringInputStream implements InputStream
20 * Load a file input stream.
23 * The file or url path to load.
25 public function __construct($data, $encoding = 'UTF-8', $debug = '')
27 // Get the contents of the file.
28 $content = file_get_contents($data);
30 parent::__construct($content, $encoding, $debug);