Package org.antlr.runtime
Class ANTLRFileStream
- java.lang.Object
-
- org.antlr.runtime.ANTLRStringStream
-
- org.antlr.runtime.ANTLRFileStream
-
- All Implemented Interfaces:
CharStream
,IntStream
public class ANTLRFileStream extends ANTLRStringStream
This is a char buffer stream that is loaded from a file all at once when you construct the object. This looks very much like an ANTLReader or ANTLRInputStream, but it's a special case since we know the exact size of the object to load. We can avoid lots of data copying.
-
-
Field Summary
Fields Modifier and Type Field Description protected String
fileName
-
Fields inherited from class org.antlr.runtime.ANTLRStringStream
charPositionInLine, data, lastMarker, line, markDepth, markers, n, name, p
-
Fields inherited from interface org.antlr.runtime.CharStream
EOF
-
-
Constructor Summary
Constructors Constructor Description ANTLRFileStream(String fileName)
ANTLRFileStream(String fileName, String encoding)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getSourceName()
Where are you getting symbols from? Normally, implementations will pass the buck all the way to the lexer who can ask its input stream for the file name or whatever.void
load(String fileName, String encoding)
-
-
-
Field Detail
-
fileName
protected String fileName
-
-
Constructor Detail
-
ANTLRFileStream
public ANTLRFileStream(String fileName) throws IOException
- Throws:
IOException
-
ANTLRFileStream
public ANTLRFileStream(String fileName, String encoding) throws IOException
- Throws:
IOException
-
-
Method Detail
-
load
public void load(String fileName, String encoding) throws IOException
- Throws:
IOException
-
getSourceName
public String getSourceName()
Description copied from interface:IntStream
Where are you getting symbols from? Normally, implementations will pass the buck all the way to the lexer who can ask its input stream for the file name or whatever.- Specified by:
getSourceName
in interfaceIntStream
- Overrides:
getSourceName
in classANTLRStringStream
-
-