'Create a new corpus view, based on the file ``fileid``, and
read with ``block_reader``.  See the class documentation
for more information.
:param fileid: The path to the file that is read by this
corpus view.  ``fileid`` can either be a string or a
``PathPointer``.
:param startpos: The file position at which the view will
start reading.  This can be used to skip over preface
sections.
:param encoding: The unicode encoding that should be used to
read the file\'s contents.  If no encoding is specified,
then the file\'s contents will be read as a non-unicode
string (i.e., a str).'

def __init__(self, fileid, block_reader=None, startpos=0, encoding='utf8'):

    if block_reader:
        self.read_block = block_reader
    self._toknum = [0]
    self._filepos = [startpos]
    self._encoding = encoding
    self._len = None
    self._fileid = fileid
    self._stream = None
    self._current_toknum = None
    'This    variable    is    set    to    the    index    of    the    next    token    that\n                                            will    be    read,    immediately    before    ``self.read_block()``    is\n                                            called.        This    is    provided    for    the    benefit    of    the    block\n                                            reader,    which    under    rare    circumstances    may    need    to    know\n                                            the    current    token    number.'
    self._current_blocknum = None
    'This    variable    is    set    to    the    index    of    the    next    block    that\n                                            will    be    read,    immediately    before    ``self.read_block()``    is\n                                            called.        This    is    provided    for    the    benefit    of    the    block\n                                            reader,    which    under    rare    circumstances    may    need    to    know\n                                            the    current    block    number.'
    try:
        if isinstance(self._fileid, PathPointer):
            self._eofpos = self._fileid.file_size()
        else:
            self._eofpos = os.stat(self._fileid).st_size
    except Exception as exc:
        raise ValueError(('Unable    to    open    or    access    %r    --    %s' % (fileid, exc)))
    self._cache = ((-1), (-1), None)
