Skip to content

Instantly share code, notes, and snippets.

@wendal
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wendal/f48dc7bc6a71f3bb76a5 to your computer and use it in GitHub Desktop.
Save wendal/f48dc7bc6a71f3bb76a5 to your computer and use it in GitHub Desktop.
被坑了一天, Java类型的问题
// data is byte[]
// tmp is OutputStream
for (int i = 0; i < data.length; i++) {
int b = data[i];
switch (b) {
case 0x55:
case 0xAA:
case 0xBB:
log.info("Found sp=" + Integer.toHexString(b));
tmp.write(0xBB);
tmp.write(data[i] + 1);
break;
default :
tmp.write(data[i]);
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment