org.antlr.runtime
Class ANTLRFileStream

java.lang.Object
  extended by org.antlr.runtime.ANTLRStringStream
      extended by 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
protected  java.lang.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
ANTLRFileStream(java.lang.String fileName)
           
ANTLRFileStream(java.lang.String fileName, java.lang.String encoding)
           
 
Method Summary
 java.lang.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(java.lang.String fileName, java.lang.String encoding)
           
 
Methods inherited from class org.antlr.runtime.ANTLRStringStream
consume, getCharPositionInLine, getLine, index, LA, LT, mark, release, reset, rewind, rewind, seek, setCharPositionInLine, setLine, size, substring
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileName

protected java.lang.String fileName
Constructor Detail

ANTLRFileStream

public ANTLRFileStream(java.lang.String fileName)
                throws java.io.IOException
Throws:
java.io.IOException

ANTLRFileStream

public ANTLRFileStream(java.lang.String fileName,
                       java.lang.String encoding)
                throws java.io.IOException
Throws:
java.io.IOException
Method Detail

load

public void load(java.lang.String fileName,
                 java.lang.String encoding)
          throws java.io.IOException
Throws:
java.io.IOException

getSourceName

public java.lang.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 interface IntStream
Overrides:
getSourceName in class ANTLRStringStream


Copyright © 2013. All Rights Reserved.