private int indexOf(byte[] pattern) {
        int count = virtualSize - (pattern.length - 1);
        for (int i = 0; i < count; i++) {
            for (int j = 0; getByte(i + j) == pattern[j]; j++) {
                if (j == pattern.length - 1) {
                    return i;
                }
            }
        }
        return -1;
    }