Package org.apache.cayenne.exp.parser
Class JavaCharStream
java.lang.Object
org.apache.cayenne.exp.parser.JavaCharStream
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 int[]
protected char[]
protected int[]
int
Position in buffer.protected int
protected int
protected Reader
protected int
protected int
protected char[]
protected int
protected boolean
protected boolean
static final boolean
Whether parser is static.protected int
-
Constructor Summary
ConstructorDescriptionJavaCharStream
(InputStream dstream) Constructor.JavaCharStream
(InputStream dstream, int startline, int startcolumn) Constructor.JavaCharStream
(InputStream dstream, int startline, int startcolumn, int buffersize) Constructor.JavaCharStream
(InputStream dstream, String encoding) Constructor.JavaCharStream
(InputStream dstream, String encoding, int startline, int startcolumn) Constructor.JavaCharStream
(InputStream dstream, String 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
Modifier and TypeMethodDescriptionvoid
adjustBeginLineColumn
(int newLine, int newCol) Method to adjust line and column numbers for the start of a token.protected void
void
backup
(int amount) Retreat.char
void
Done()
Set buffers back to null when finished.protected void
ExpandBuff
(boolean wrapAround) protected void
FillBuff()
int
int
int
Get end column.int
Get end line.GetImage()
char[]
GetSuffix
(int len) protected int
getTabSize
(int i) protected char
ReadByte()
char
readChar()
Read a character.void
ReInit
(InputStream dstream) Reinitialise.void
ReInit
(InputStream dstream, int startline, int startcolumn) Reinitialise.void
ReInit
(InputStream dstream, int startline, int startcolumn, int buffersize) Reinitialise.void
ReInit
(InputStream dstream, String encoding) Reinitialise.void
ReInit
(InputStream dstream, String encoding, int startline, int startcolumn) Reinitialise.void
ReInit
(InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) Reinitialise.void
Reinitialise.void
Reinitialise.void
Reinitialise.protected void
setTabSize
(int i) protected void
UpdateLineColumn
(char c)
-
Field Details
-
staticFlag
public static final boolean staticFlagWhether parser is static.- See Also:
-
bufpos
public int bufposPosition in buffer. -
bufline
protected int[] bufline -
bufcolumn
protected int[] bufcolumn -
column
protected int column -
line
protected int line -
prevCharIsCR
protected boolean prevCharIsCR -
prevCharIsLF
protected boolean prevCharIsLF -
inputStream
-
nextCharBuf
protected char[] nextCharBuf -
buffer
protected char[] buffer -
maxNextCharInd
protected int maxNextCharInd -
nextCharInd
protected int nextCharInd -
inBuf
protected int inBuf -
tabSize
protected int tabSize
-
-
Constructor Details
-
JavaCharStream
Constructor. -
JavaCharStream
Constructor. -
JavaCharStream
Constructor. -
JavaCharStream
public JavaCharStream(InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws UnsupportedEncodingException Constructor.- Throws:
UnsupportedEncodingException
-
JavaCharStream
Constructor. -
JavaCharStream
public JavaCharStream(InputStream dstream, String encoding, int startline, int startcolumn) throws UnsupportedEncodingException Constructor.- Throws:
UnsupportedEncodingException
-
JavaCharStream
Constructor. -
JavaCharStream
Constructor.- Throws:
UnsupportedEncodingException
-
JavaCharStream
Constructor.
-
-
Method Details
-
setTabSize
protected void setTabSize(int i) -
getTabSize
protected int getTabSize(int i) -
ExpandBuff
protected void ExpandBuff(boolean wrapAround) -
FillBuff
- Throws:
IOException
-
ReadByte
- Throws:
IOException
-
BeginToken
- Returns:
- starting character for token.
- Throws:
IOException
-
AdjustBuffSize
protected void AdjustBuffSize() -
UpdateLineColumn
protected void UpdateLineColumn(char c) -
readChar
Read a character.- Throws:
IOException
-
getEndColumn
public int getEndColumn()Get end column. -
getEndLine
public int getEndLine()Get end line. -
getBeginColumn
public int getBeginColumn()- Returns:
- column of token start
-
getBeginLine
public int getBeginLine()- Returns:
- line number of token start
-
backup
public void backup(int amount) Retreat. -
ReInit
Reinitialise. -
ReInit
Reinitialise. -
ReInit
Reinitialise. -
ReInit
public void ReInit(InputStream dstream, String encoding, int startline, int startcolumn, int buffersize) throws UnsupportedEncodingException Reinitialise.- Throws:
UnsupportedEncodingException
-
ReInit
Reinitialise. -
ReInit
public void ReInit(InputStream dstream, String encoding, int startline, int startcolumn) throws UnsupportedEncodingException Reinitialise.- Throws:
UnsupportedEncodingException
-
ReInit
Reinitialise. -
ReInit
Reinitialise.- Throws:
UnsupportedEncodingException
-
ReInit
Reinitialise. -
GetImage
- Returns:
- token image as String
-
GetSuffix
public char[] GetSuffix(int len) - Returns:
- suffix
-
Done
public void Done()Set buffers back to null when finished. -
adjustBeginLineColumn
public void adjustBeginLineColumn(int newLine, int newCol) Method to adjust line and column numbers for the start of a token.
-