Class JavaCharStream
- java.lang.Object
 - 
- fr.mines_stetienne.ci.sparql_generate.lang.AbstractCharStream
 - 
- fr.mines_stetienne.ci.sparql_generate.lang.JavaCharStream
 
 
 
- 
- All Implemented Interfaces:
 CharStream
public class JavaCharStream extends AbstractCharStream
An implementation of interface CharStream, where the stream is assumed to contain only ASCII characters (with java-like unicode escape processing). 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected ReaderinputStreamprotected static intNEXTCHAR_BUF_SIZEPredefined buffer sizeprotected char[]nextCharBufprotected intnextCharInd- 
Fields inherited from class fr.mines_stetienne.ci.sparql_generate.lang.AbstractCharStream
available, bufcolumn, buffer, BUFFER_INCREASE, bufline, bufpos, bufsize, column, DEFAULT_BUF_SIZE, inBuf, line, maxNextCharInd, prevCharIsCR, prevCharIsLF, tokenBegin 
 - 
 
- 
Constructor Summary
Constructors Constructor Description JavaCharStream(InputStream dstream, Charset encoding)Constructor.JavaCharStream(InputStream dstream, Charset encoding, int startline, int startcolumn)Constructor.JavaCharStream(InputStream dstream, Charset encoding, int startline, int startcolumn, int buffersize)Constructor.JavaCharStream(Reader dstream)Constructor.JavaCharStream(Reader dstream, int startline, int startcolumn)Constructor.JavaCharStream(Reader dstream, int startline, int startcolumn, int buffersize)Constructor. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidadjustBuffSize()charbeginToken()voiddone()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 voidfillBuff()protected charreadByte()charreadChar()Read a character.voidreInit(InputStream dstream, Charset encoding)Reinitialise.voidreInit(InputStream dstream, Charset encoding, int startline, int startcolumn)Reinitialise.voidreInit(InputStream dstream, Charset encoding, int startline, int startcolumn, int buffersize)Reinitialise.voidreInit(Reader dstream)Reinitialise.voidreInit(Reader dstream, int startline, int startcolumn)Reinitialise.voidreInit(Reader dstream, int startline, int startcolumn, int buffersize)Reinitialise.protected voidstreamClose()protected intstreamRead(char[] buffer, int offset, int len)- 
Methods inherited from class fr.mines_stetienne.ci.sparql_generate.lang.AbstractCharStream
adjustBeginLineColumn, backup, expandBuff, getBeginColumn, getBeginLine, getEndColumn, getEndLine, getImage, getSuffix, getTabSize, isTrackLineColumn, reInit, setTabSize, setTrackLineColumn, updateLineColumn 
 - 
 
 - 
 
- 
- 
Field Detail
- 
NEXTCHAR_BUF_SIZE
protected static final int NEXTCHAR_BUF_SIZE
Predefined buffer size- See Also:
 - Constant Field Values
 
 
- 
nextCharBuf
protected char[] nextCharBuf
 
- 
nextCharInd
protected int nextCharInd
 
- 
inputStream
protected Reader inputStream
 
 - 
 
- 
Constructor Detail
- 
JavaCharStream
public JavaCharStream(Reader dstream, int startline, int startcolumn, int buffersize)
Constructor. 
- 
JavaCharStream
public JavaCharStream(Reader dstream, int startline, int startcolumn)
Constructor. 
- 
JavaCharStream
public JavaCharStream(Reader dstream)
Constructor. 
- 
JavaCharStream
public JavaCharStream(InputStream dstream, Charset encoding, int startline, int startcolumn, int buffersize)
Constructor. 
- 
JavaCharStream
public JavaCharStream(InputStream dstream, Charset encoding, int startline, int startcolumn)
Constructor. 
- 
JavaCharStream
public JavaCharStream(InputStream dstream, Charset encoding)
Constructor. 
 - 
 
- 
Method Detail
- 
streamRead
protected int streamRead(char[] buffer, int offset, int len) throws IOException- Specified by:
 streamReadin classAbstractCharStream- Throws:
 IOException
 
- 
streamClose
protected void streamClose() throws IOException- Specified by:
 streamClosein classAbstractCharStream- Throws:
 IOException
 
- 
fillBuff
protected void fillBuff() throws IOException- Overrides:
 fillBuffin classAbstractCharStream- Throws:
 IOException
 
- 
readByte
protected char readByte() throws IOException- Throws:
 IOException
 
- 
beginToken
public char beginToken() throws IOException- Specified by:
 beginTokenin interfaceCharStream- Overrides:
 beginTokenin classAbstractCharStream- Returns:
 - starting character for token.
 - Throws:
 IOException
 
- 
adjustBuffSize
protected void adjustBuffSize()
 
- 
readChar
public char readChar() throws IOExceptionRead a character.- Specified by:
 readCharin interfaceCharStream- Overrides:
 readCharin classAbstractCharStream- Returns:
 - the next character from the selected input
 - Throws:
 IOException- on IO error
 
- 
reInit
public void reInit(Reader dstream)
Reinitialise. 
- 
reInit
public void reInit(Reader dstream, int startline, int startcolumn)
Reinitialise. 
- 
reInit
public void reInit(Reader dstream, int startline, int startcolumn, int buffersize)
Reinitialise. 
- 
reInit
public void reInit(InputStream dstream, Charset encoding)
Reinitialise. 
- 
reInit
public void reInit(InputStream dstream, Charset encoding, int startline, int startcolumn)
Reinitialise. 
- 
reInit
public void reInit(InputStream dstream, Charset encoding, int startline, int startcolumn, int buffersize)
Reinitialise. 
- 
done
public void done()
Description copied from interface:CharStreamThe 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:
 donein interfaceCharStream- Overrides:
 donein classAbstractCharStream
 
 - 
 
 -