Deprecated
as of 4.7 Please use CharStreams interface.
Reader/InputStream and then treat it
like a char[] buffer. Can also pass in a String or
char[] to use.
If you need encoding, pass in stream/reader with correct encoding.
| Modifier and Type | Field and Description |
|---|---|
| protected char[] | data
The data being scanned |
| public static final int | |
| protected int | n
How many characters are actually in the buffer |
| public String | name
What is name or source of this char stream? |
| protected int | p
0..n-1 index into string of next char |
| public static final int |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | ANTLRInputStream(char[] data, int numberOfActualCharsInArray)
This is the preferred constructor for strings as no data is copied |
| public | |
| public | |
| public | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | consume()
Implements org. |
| public String | getSourceName()
Implements org. |
| public String | getText(Interval
an interval within the stream interval)Implements org. |
| public int | index()
Implements org. |
| public int | LA(int i)
Implements org. i from the current
position.
|
| public void | |
| public int | |
| public int | mark()
Implements org. |
| public void | release(int
A marker returned by a call to marker)mark().Implements org. mark().
|
| public void | reset()
Reset the stream so that it's in the same state it was when the object was created *except* the data array is not touched. |
| public void | seek(int
The absolute index to seek to. index)Implements org. |
| public int | size()
Implements org. |
| public String |
| data | back to summary |
|---|---|
| protected char[] data The data being scanned | |
| INITIAL_BUFFER_SIZE | back to summary |
|---|---|
| public static final int INITIAL_BUFFER_SIZE | |
| n | back to summary |
|---|---|
| protected int n How many characters are actually in the buffer | |
| name | back to summary |
|---|---|
| public String name What is name or source of this char stream? | |
| p | back to summary |
|---|---|
| protected int p 0..n-1 index into string of next char | |
| READ_BUFFER_SIZE | back to summary |
|---|---|
| public static final int READ_BUFFER_SIZE | |
| ANTLRInputStream | back to summary |
|---|---|
| public ANTLRInputStream() | |
| ANTLRInputStream | back to summary |
|---|---|
| public ANTLRInputStream(String input) Copy data in string to a local char array | |
| ANTLRInputStream | back to summary |
|---|---|
| public ANTLRInputStream(char[] data, int numberOfActualCharsInArray) This is the preferred constructor for strings as no data is copied | |
| ANTLRInputStream | back to summary |
|---|---|
| public ANTLRInputStream(Reader r) throws IOException | |
| ANTLRInputStream | back to summary |
|---|---|
| public ANTLRInputStream(Reader r, int initialSize) throws IOException | |
| ANTLRInputStream | back to summary |
|---|---|
| public ANTLRInputStream(Reader r, int initialSize, int readChunkSize) throws IOException | |
| ANTLRInputStream | back to summary |
|---|---|
| public ANTLRInputStream(InputStream input) throws IOException | |
| ANTLRInputStream | back to summary |
|---|---|
| public ANTLRInputStream(InputStream input, int initialSize) throws IOException | |
| ANTLRInputStream | back to summary |
|---|---|
| public ANTLRInputStream(InputStream input, int initialSize, int readChunkSize) throws IOException | |
| consume | back to summary |
|---|---|
| public void consume() Implements org. Doc from org. Consumes the current symbol in the stream. This method has the following effects:
index() is
incremented by exactly 1, as that would preclude the ability to implement
filtering streams (e.g. CommonTokenStream which distinguishes
between "on-channel" and "off-channel" tokens).
| |
| getSourceName | back to summary |
|---|---|
| public String getSourceName() Implements org. Doc from org. Gets the name of the underlying symbol source. This method returns a
non-null, non-empty string. If such a name is not known, this method
returns
| |
| getText | back to summary |
|---|---|
| public String getText(Interval interval) Implements org. Doc from org. This method returns the text for a range of characters within this input
stream. This method is guaranteed to not throw an exception if the
specified | |
| index | back to summary |
|---|---|
| public int index() Implements org. Return the current input symbol index 0..n where n indicates the last symbol has been read. The index is the index of char to be returned from LA(1).
| |
| LA | back to summary |
|---|---|
| public int LA(int i) Implements org. Doc from org. Gets the value of the symbol at offset This method is guaranteed to succeed if any of the following are true:
If The return value is unspecified if
| |
| load | back to summary |
|---|---|
| public void load(Reader r, int size, int readChunkSize) throws IOException | |
| LT | back to summary |
|---|---|
| public int LT(int i) | |
| mark | back to summary |
|---|---|
| public int mark() Implements org. mark/release do nothing; we have entire buffer
| |
| release | back to summary |
|---|---|
| public void release(int marker) Implements org. Doc from org. This method releases a marked range created by a call to
For more information and an example, see
| |
| reset | back to summary |
|---|---|
| public void reset() Reset the stream so that it's in the same state it was when the object was created *except* the data array is not touched. | |
| seek | back to summary |
|---|---|
| public void seek(int index) Implements org. consume() ahead until p==index; can't just set p=index as we must update line and charPositionInLine. If we seek backwards, just set p
| |
| size | back to summary |
|---|---|
| public int size() Implements org. Doc from org. Returns the total number of symbols in the stream, including a single EOF symbol.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |