Class JavaCharStream
java.lang.Object
com.mayam.wf.attributes.shared.expr.AbstractCharStream
com.mayam.wf.attributes.shared.expr.JavaCharStream
- All Implemented Interfaces:
CharStream
An implementation of interface CharStream, where the stream is assumed to
contain only ASCII characters (with java-like unicode escape processing).
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
Predefined buffer sizeFields inherited from class com.mayam.wf.attributes.shared.expr.AbstractCharStream
available, buffer, bufpos, bufsize, DEFAULT_BUF_SIZE, inBuf, maxNextCharInd, tokenBegin
-
Constructor Summary
ConstructorDescriptionJavaCharStream
(Provider dstream) Constructor.JavaCharStream
(Provider dstream, int startline, int startcolumn) Constructor.JavaCharStream
(Provider dstream, int startline, int startcolumn, int buffersize) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionchar
void
done()
The lexer calls this function to indicate that it is done with the stream and hence implementations can free any resources held by this class.protected void
fillBuff()
char
readChar()
Get the next character from the selected input.void
Reinitialise.void
Reinitialise.void
Reinitialise.protected void
Close the underlying stream.protected int
streamRead
(char[] buffer, int offset, int len) Read from the underlying stream.Methods inherited from class com.mayam.wf.attributes.shared.expr.AbstractCharStream
adjustBeginLineColumn, backup, expandBuff, getBeginColumn, getBeginLine, getBufSizeAfterExpansion, getColumn, getEndColumn, getEndLine, getImage, getLine, getSuffix, getTabSize, internalAdjustBuffSize, internalSetBufLineColumn, internalUpdateLineColumn, isTrackLineColumn, reInit, setTabSize, setTrackLineColumn
-
Field Details
-
NEXTCHAR_BUF_SIZE
protected static final int NEXTCHAR_BUF_SIZEPredefined buffer size- See Also:
-
-
Constructor Details
-
Method Details
-
streamRead
Description copied from class:AbstractCharStream
Read from the underlying stream.- Specified by:
streamRead
in classAbstractCharStream
- Parameters:
buffer
- the buffer to be filledoffset
- The offset into the buffer. 0-basedlen
- Number of chars to read.- Returns:
- Number of effective chars read, or -1 on error.
- Throws:
IOException
-
streamClose
Description copied from class:AbstractCharStream
Close the underlying stream.- Specified by:
streamClose
in classAbstractCharStream
- Throws:
IOException
- If closing fails.
-
fillBuff
- Overrides:
fillBuff
in classAbstractCharStream
- Throws:
IOException
-
beginToken
- Specified by:
beginToken
in interfaceCharStream
- Overrides:
beginToken
in classAbstractCharStream
- Returns:
- the next character that marks the beginning of the next token. All characters must remain in the buffer between two successive calls to this method to implement backup correctly.
- Throws:
IOException
-
readChar
Description copied from interface:CharStream
Get the next character from the selected input. The method of selecting the input is the responsibility of the class implementing this interface.- Specified by:
readChar
in interfaceCharStream
- Overrides:
readChar
in classAbstractCharStream
- Returns:
- the next character from the selected input
- Throws:
IOException
- on IO error
-
done
public void done()Description copied from interface:CharStream
The lexer calls this function to indicate that it is done with the stream and hence implementations can free any resources held by this class. Again, the body of this function can be just empty and it will not affect the lexer's operation.- Specified by:
done
in interfaceCharStream
- Overrides:
done
in classAbstractCharStream
-