FileInputStream
class FileInputStream extends StringInputStream implements InputStream
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).
Properties
$errors | Parse errors. | from StringInputStream |
Methods
Load a file input stream.
Returns the current column of the current line that the tokenizer is at.
Read to a particular match (or until $max bytes are consumed).
Returns the string so long as $bytes matches.
Details
at line line 25
__construct($data, $encoding = 'UTF-8', $debug = '')
Load a file input stream.
in StringInputStream at line line 112
currentLine()
Returns the current line that the tokenizer is at.
in StringInputStream at line line 127
getCurrentLine()
in StringInputStream at line line 139
int
columnOffset()
Returns the current column of the current line that the tokenizer is at.
Newlines are column 0. The first char after a newline is column 1.
in StringInputStream at line line 170
getColumnOffset()
in StringInputStream at line line 180
string
current()
Get the current character.
in StringInputStream at line line 189
next()
Advance the pointer.
This is part of the Iterator interface.
in StringInputStream at line line 197
rewind()
Rewind to the start of the string.
in StringInputStream at line line 207
bool
valid()
Is the current pointer location valid.
in StringInputStream at line line 227
remainingChars()
Get all characters until EOF.
This reads to the end of the file, and sets the read marker at the end of the file.
in StringInputStream at line line 254
mixed
charsUntil(
string $bytes,
int $max = null)
Read to a particular match (or until $max bytes are consumed).
This operates on byte sequences, not characters.
Matches as far as possible until we reach a certain set of bytes and returns the matched substring.
in StringInputStream at line line 285
charsWhile(
string $bytes,
int $max = null)
Returns the string so long as $bytes matches.
Matches as far as possible with a certain set of bytes and returns the matched substring.
in StringInputStream at line line 308
unconsume(
int $howMany = 1)
Unconsume characters.
in StringInputStream at line line 318
peek()
Look ahead without moving cursor.