@classmethod
def indexOf(cls, data, pattern, index, count):
    """
        Finds the first occurrence of the pattern in the text.
        data : Data where to find.
        pattern : Search pattern.
        index : Byte index to start.
        count : Count of bytes to search.
        Return True if pattern is found.
        """
    failure = cls.__computeFailure(pattern)
    j = 0
    if not data or len(data) < index:
        return -1
    for i in range(index, count):
        while j > 0 and pattern[j] != data[i]:
            j = failure[j - 1]
        if pattern[j] == data[i]:
            j = j + 1
        if j == len(pattern):
            return i - len(pattern) + 1
    return -1
