'Returns the position of the first occurence of needle.
If the needle was not found, -1 is returned.
:rtype : int'

def find(self):

    lastbuf = ''
    while (0 < self._fp.tell()):
        buf = self._read()
        bufpos = (buf + lastbuf).rfind(self._needle)
        if (bufpos > (-1)):
            filepos = (self._fp.tell() + bufpos)
            self._fp.seek(filepos)
            return filepos
        lastbuf = buf[:len(self._needle)]
    return (-1)
