Fixed issue #8 - search for MAGIC bytes instead of just checking
(NOW it should work)
This commit is contained in:
parent
a053b64fe6
commit
b40d2e9f73
@ -201,13 +201,15 @@ class V3MessageFactory {
|
|||||||
for (int i = 0; i < 1620000; i++) {
|
for (int i = 0; i < 1620000; i++) {
|
||||||
byte b = (byte) in.read();
|
byte b = (byte) in.read();
|
||||||
if (b == MAGIC_BYTES[pos]) {
|
if (b == MAGIC_BYTES[pos]) {
|
||||||
pos++;
|
if (pos + 1 == MAGIC_BYTES.length) {
|
||||||
if (pos == MAGIC_BYTES.length) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else if (pos > 0 && b == MAGIC_BYTES[0]) {
|
||||||
|
pos = 1;
|
||||||
} else {
|
} else {
|
||||||
pos = 0;
|
pos = 0;
|
||||||
}
|
}
|
||||||
|
pos++;
|
||||||
}
|
}
|
||||||
throw new IOException("Failed to fine MAGIC bytes in stream");
|
throw new IOException("Failed to fine MAGIC bytes in stream");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user