MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / indexOf

Method indexOf

src/main/java/core/packetproxy/common/Utils.java:44–63  ·  view source on GitHub ↗
(byte[] input_data, int start_idx, int end_idx, byte[] word)

Source from the content-addressed store, hash-verified

42 }
43
44 public static int indexOf(byte[] input_data, int start_idx, int end_idx, byte[] word) {
45 assert (end_idx <= input_data.length);
46 for (int i = start_idx + word.length - 1; i < end_idx; i++) {
47
48 int start_input_idx = i - word.length + 1;
49 int word_idx;
50 for (word_idx = 0; word_idx < word.length && start_input_idx + word_idx < input_data.length; word_idx++) {
51
52 if (word[word_idx] != input_data[start_input_idx + word_idx]) {
53
54 break;
55 }
56 }
57 if (word_idx == word.length) {
58
59 return start_input_idx;
60 }
61 }
62 return -1;
63 }
64
65 /**
66 * OSの名前を返す

Callers 15

bruteforceSearchMethod · 0.95
getHttpBodyMethod · 0.95
getChankedHttpBodyMethod · 0.95
HttpHeaderMethod · 0.95
replaceBinaryMethod · 0.95

Calls

no outgoing calls

Tested by 1

testFindHostHeaderMethod · 0.64