in src/main/java/com/amazonaws/kinesisvideo/encoding/ChunkDecoder.java [99:117]
public static int arrayIndexOf(final byte[] haystack, final int tail, final int head, final byte[] needle) {
int index = tail;
while (index != head) {
boolean match = false;
for (int j = 0; j < needle.length; j++) {
match = haystack[(index + j) % haystack.length] == needle[j];
if (!match) {
break;
}
}
if (match) {
return index;
}
index = (index == haystack.length - 1) ? 0 : index + 1;
}
return -1;
}