mark.
Initializing Methods: Some methods in this interface have unspecified behavior if no call to an initializing method has occurred after the stream was constructed. The following is a list of initializing methods:
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| public static final String | UNKNOWN_SOURCE_NAME
The value returned by |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public String | |
| public int | |
| public int | |
| public int | |
| public void | |
| public void | seek(int
The absolute index to seek to. index)Set the input cursor to the position indicated by |
| public int |
| EOF | back to summary |
|---|---|
| public static final int EOF The value returned by | |
| UNKNOWN_SOURCE_NAME | back to summary |
|---|---|
| public static final String UNKNOWN_SOURCE_NAME The value returned by | |
| consume | back to summary |
|---|---|
| public void consume() 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() 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 | |
| index | back to summary |
|---|---|
| public int index() Return the index into the stream of the input symbol referred to by
The behavior of this method is unspecified if no call to an
| |
| LA | back to summary |
|---|---|
| public int LA(int i) 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
| |
| mark | back to summary |
|---|---|
| public int mark() A mark provides a guarantee that The returned mark is an opaque handle (type The behavior of this method is unspecified if no call to an
This method does not change the current position in the input stream. The following example shows the use of
IntStream stream = ...;
int index = -1;
int mark = stream.mark();
try {
index = stream.index();
// perform work here...
} finally {
if (index != -1) {
stream.seek(index);
}
stream.release(mark);
}
| |
| release | back to summary |
|---|---|
| public void release(int marker) This method releases a marked range created by a call to
For more information and an example, see
| |
| seek | back to summary |
|---|---|
| public void seek(int index) Set the input cursor to the position indicated by
index
lies within a marked region. For more information on marked regions, see
mark. The behavior of this method is unspecified if no call to
an initializing method has occurred after this stream
was constructed.
| |
| size | back to summary |
|---|---|
| public int size() Returns the total number of symbols in the stream, including a single EOF symbol.
| |