ANTLRInputStream

Vacuum all input from a {@link Reader}/{@link InputStream} and then treat it like a {@code char[]} buffer. Can also pass in a {@link String} or {@code char[]} to use.

<p>If you need encoding, pass in stream/reader with correct encoding.</p>

Constructors

this
this()
Undocumented in source.
this
this(string input)

Copy data in string to a local char array

this
this(char[] data, int numberOfActualCharsInArray)

This is the preferred constructor for strings as no data is copied

this
this(File r)
Undocumented in source.

Members

Functions

LA
int LA(int i)

@uml @override

LT
int LT(int i)
Undocumented in source. Be warned that the author may not have intended to support it.
consume
void consume()

@uml @override

getSourceName
string getSourceName()

@uml @override

getText
string getText(Interval interval)

@uml @override

index
int index()

@uml @override

load
void load(File r, int size, int readChunkSize)
Undocumented in source. Be warned that the author may not have intended to support it.
mark
int mark()

mark/release do nothing; we have entire buffer @uml @override

release
void release(int marker)

@uml @override

reset
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
void seek(int index)

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 @uml @override

size
int size()

@uml @override

toString
string toString()

@uml @override

Static variables

INITIAL_BUFFER_SIZE
int INITIAL_BUFFER_SIZE;
Undocumented in source.
READ_BUFFER_SIZE
int READ_BUFFER_SIZE;
Undocumented in source.

Variables

data
char[] data;

The data being scanned

n
int n;

How many characters are actually in the buffer

name
string name;

What is name or source of this char stream?

p
int p;

0..n-1 index into string of next char

Inherited Members

From CharStream

getText
string getText(Interval interval)

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 {@code interval} lies entirely within a marked range. For more information about marked ranges, see {@link IntStream#mark}.

Meta