CharStreams interface.@Deprecated public class ANTLRInputStream extends Object implements UnicodeCharStream, CharStream
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.
| 限定符和类型 | 字段和说明 |
|---|---|
protected char[] |
data
已过时。
The data being scanned
|
static int |
INITIAL_BUFFER_SIZE
已过时。
|
protected int |
n
已过时。
How many characters are actually in the buffer
|
String |
name
已过时。
What is name or source of this char stream?
|
protected int |
p
已过时。
0..n-1 index into string of next char
|
static int |
READ_BUFFER_SIZE
已过时。
|
EOF, UNKNOWN_SOURCE_NAME| 构造器和说明 |
|---|
ANTLRInputStream()
已过时。
|
ANTLRInputStream(char[] data,
int numberOfActualCharsInArray)
已过时。
This is the preferred constructor for strings as no data is copied
|
ANTLRInputStream(InputStream input)
已过时。
|
ANTLRInputStream(InputStream input,
int initialSize)
已过时。
|
ANTLRInputStream(InputStream input,
int initialSize,
int readChunkSize)
已过时。
|
ANTLRInputStream(Reader r)
已过时。
|
ANTLRInputStream(Reader r,
int initialSize)
已过时。
|
ANTLRInputStream(Reader r,
int initialSize,
int readChunkSize)
已过时。
|
ANTLRInputStream(String input)
已过时。
Copy data in string to a local char array
|
| 限定符和类型 | 方法和说明 |
|---|---|
void |
consume()
已过时。
Consumes the current symbol in the stream.
|
String |
getSourceName()
已过时。
Gets the name of the underlying symbol source.
|
String |
getText(Interval interval)
已过时。
This method returns the text for a range of characters within this input
stream.
|
int |
index()
已过时。
Return the current input symbol index 0..n where n indicates the
last symbol has been read.
|
int |
LA(int i)
已过时。
Gets the value of the symbol at offset
i from the current
position. |
void |
load(Reader r,
int size,
int readChunkSize)
已过时。
|
int |
LT(int i)
已过时。
|
int |
mark()
已过时。
mark/release do nothing; we have entire buffer
|
void |
release(int marker)
已过时。
This method releases a marked range created by a call to
mark(). |
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.
|
void |
seek(int index)
已过时。
consume() ahead until p==index; can't just set p=index as we must
update line and charPositionInLine.
|
int |
size()
已过时。
Returns the total number of symbols in the stream, including a single EOF
symbol.
|
boolean |
supportsUnicodeCodePoints()
已过时。
Determines if the current stream supports Unicode code points.
|
String |
toString()
已过时。
|
public static final int READ_BUFFER_SIZE
public static final int INITIAL_BUFFER_SIZE
protected char[] data
protected int n
protected int p
public String name
public ANTLRInputStream()
public ANTLRInputStream(String input)
public ANTLRInputStream(char[] data,
int numberOfActualCharsInArray)
public ANTLRInputStream(Reader r) throws IOException
IOExceptionpublic ANTLRInputStream(Reader r, int initialSize) throws IOException
IOExceptionpublic ANTLRInputStream(Reader r, int initialSize, int readChunkSize) throws IOException
IOExceptionpublic ANTLRInputStream(InputStream input) throws IOException
IOExceptionpublic ANTLRInputStream(InputStream input, int initialSize) throws IOException
IOExceptionpublic ANTLRInputStream(InputStream input, int initialSize, int readChunkSize) throws IOException
IOExceptionpublic void load(Reader r, int size, int readChunkSize) throws IOException
IOExceptionpublic void reset()
public void consume()
IntStreamindex()
before calling this method is less than the value of index()
after calling this method.LA(1) before
calling this method becomes the value of LA(-1) after calling
this method.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).public int LA(int i)
IntStreami from the current
position. When i==1, this method returns the value of the current
symbol in the stream (which is the next symbol to be consumed). When
i==-1, this method returns the value of the previously read
symbol in the stream. It is not valid to call this method with
i==0, but the specific behavior is unspecified because this
method is frequently called from performance-critical code.
This method is guaranteed to succeed if any of the following are true:
i>0i==-1 and index() returns a value greater
than the value of index() after the stream was constructed
and LA(1) was called in that order. Specifying the current
index() relative to the index after the stream was created
allows for filtering implementations that do not return every symbol
from the underlying source. Specifying the call to LA(1)
allows for lazily initialized streams.LA(i) refers to a symbol consumed within a marked region
that has not yet been released.If i represents a position at or beyond the end of the stream,
this method returns IntStream.EOF.
The return value is unspecified if i<0 and fewer than -i
calls to consume() have occurred from the beginning of
the stream before calling this method.
public int LT(int i)
public int index()
public int size()
IntStreampublic int mark()
public void release(int marker)
IntStreammark(). Calls to release() must appear in the
reverse order of the corresponding calls to mark(). If a mark is
released twice, or if marks are not released in reverse order of the
corresponding calls to mark(), the behavior is unspecified.
For more information and an example, see IntStream.mark().
release 在接口中 IntStreammarker - A marker returned by a call to mark().IntStream.mark()public void seek(int index)
public String getText(Interval interval)
CharStreaminterval lies entirely within a marked range. For more
information about marked ranges, see IntStream.mark().getText 在接口中 CharStreaminterval - an interval within the streampublic String getSourceName()
IntStreamIntStream.UNKNOWN_SOURCE_NAME.getSourceName 在接口中 IntStreampublic boolean supportsUnicodeCodePoints()
supportsUnicodeCodePoints 在接口中 UnicodeCharStreamtrue if the current input stream supports Unicode code
points; otherwise, false if the current input stream returns
UTF-16 code units for code points above U+FFFF.Copyright © 1992–2022 Daniel Sun. All rights reserved.