'@param file A file-like object holding your input. Only the read()
method must be implemented.
@param encoding If you set the optional encoding argument, then the
data will be decoded on the fly.'

def __init__(self, file, encoding=None):

    if (encoding is not None):
        reader = codecs.lookup(encoding)[2]
        file = reader(file)
    data = file.read()
    ANTLRStringStream.__init__(self, data)
