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 Reader
inputStream
protected static int
NEXTCHAR_BUF_SIZE
Predefined buffer sizeprotected char[]
nextCharBuf
protected int
nextCharInd
-
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 void
adjustBuffSize()
char
beginToken()
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()
protected char
readByte()
char
readChar()
Read a character.void
reInit(InputStream dstream, Charset encoding)
Reinitialise.void
reInit(InputStream dstream, Charset encoding, int startline, int startcolumn)
Reinitialise.void
reInit(InputStream dstream, Charset encoding, int startline, int startcolumn, int buffersize)
Reinitialise.void
reInit(Reader dstream)
Reinitialise.void
reInit(Reader dstream, int startline, int startcolumn)
Reinitialise.void
reInit(Reader dstream, int startline, int startcolumn, int buffersize)
Reinitialise.protected void
streamClose()
protected int
streamRead(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:
streamRead
in classAbstractCharStream
- Throws:
IOException
-
streamClose
protected void streamClose() throws IOException
- Specified by:
streamClose
in classAbstractCharStream
- Throws:
IOException
-
fillBuff
protected void fillBuff() throws IOException
- Overrides:
fillBuff
in classAbstractCharStream
- Throws:
IOException
-
readByte
protected char readByte() throws IOException
- Throws:
IOException
-
beginToken
public char beginToken() throws IOException
- Specified by:
beginToken
in interfaceCharStream
- Overrides:
beginToken
in classAbstractCharStream
- Returns:
- starting character for token.
- Throws:
IOException
-
adjustBuffSize
protected void adjustBuffSize()
-
readChar
public char readChar() throws IOException
Read a character.- Specified by:
readChar
in interfaceCharStream
- Overrides:
readChar
in 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: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
-
-