You are here

class FileInputStream in Zircon Profile 8

Same name and namespace in other branches
  1. 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

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\Parser
View 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

Namesort descending Modifiers Type Description Overrides
FileInputStream::__construct public function Load a file input stream. Overrides StringInputStream::__construct
StringInputStream::$char private property The current integer byte position we are in $data
StringInputStream::$data private property The string data we're parsing.
StringInputStream::$EOF private property Length of $data; when $char === $data, we are at the end-of-file.
StringInputStream::$errors public property Parse errors.
StringInputStream::charsUntil public function Read to a particular match (or until $max bytes are consumed). Overrides InputStream::charsUntil
StringInputStream::charsWhile public function Returns the string so long as $bytes matches. Overrides InputStream::charsWhile
StringInputStream::columnOffset public function Returns the current column of the current line that the tokenizer is at. Overrides InputStream::columnOffset
StringInputStream::current public function Get the current character.
StringInputStream::currentLine public function Returns the current line that the tokenizer is at. Overrides InputStream::currentLine
StringInputStream::getColumnOffset public function
StringInputStream::getCurrentLine public function
StringInputStream::key public function
StringInputStream::next public function Advance the pointer. This is part of the Iterator interface.
StringInputStream::peek public function Look ahead without moving cursor. Overrides InputStream::peek
StringInputStream::remainingChars public function Get all characters until EOF. Overrides InputStream::remainingChars
StringInputStream::replaceLinefeeds protected function Replace linefeed characters according to the spec.
StringInputStream::rewind public function Rewind to the start of the string.
StringInputStream::unconsume public function Unconsume characters. Overrides InputStream::unconsume
StringInputStream::valid public function Is the current pointer location valid.