|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--goldengine.java.LookAheadStream
-------------------------------------------------------------------------------------------
Source File: LookAheadStream.java
Author: Matthew Hawkins
Description: A stream implementation that uses a PushbackReader, to read the source
file character by character, and will place characters on a char buffer.
This char buffer is then used when a token needs to be read.
-------------------------------------------------------------------------------------------
Revision List
Author Version Description
------ ------- -----------
MPH 1.0 First Issue
MPH 1.1 Fixed a bug with discarding a line for comments
| Constructor Summary | |
LookAheadStream()
|
|
| Method Summary | |
boolean |
closeFile()
closeFile This method will close the source file. |
boolean |
done()
done This method checks the next character to see if it is the end of the file. |
java.lang.String |
nextChar()
nextChar This method will read one character (int) from the stream. |
boolean |
nextCharNotWhitespace()
nextCharNotWhitespace A quick checker method which checks to see if the next character is whitespace. |
boolean |
openFile(java.lang.String file)
openFile This method will open the source file to read. |
java.lang.String |
read(int size)
read This method will return a String of length size. |
java.lang.String |
readLine()
readLine #ver1.1# This method will read characters from the buffer until a line feed or carriage return is found. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public LookAheadStream()
| Method Detail |
public boolean openFile(java.lang.String file)
throws ParserException
- name> - Returns:
- True if the file was opened. It will not return false,
as an exception should be thrown beforehand.
- Throws:
ParserException - If the PushbackReader was not initialised.
public boolean closeFile()
throws ParserException
ParserException - if the file could not be closed.
public boolean done()
throws ParserException
ParserException - if the stream could not be read.
public boolean nextCharNotWhitespace()
throws ParserException
ParserException - if the stream could not be read.
public java.lang.String nextChar()
throws ParserException
ParserException - if the stream could not be read.
public java.lang.String read(int size)
throws ParserException
size.
The String is contained in the buffer of read characters.size - The number of characters to read from the buffer.ParserException - if the stream could not be read.
public java.lang.String readLine()
throws ParserException
nextChar first to place them on the
buffer. This method had a bug where the end of the line could not
be found.ParserException - if the stream could not be read.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||