Came across this lovely gem. When reading a binary stream in Java, don't use an InputStreamReader. The issue I ran into is when casting a read() into a byte, the value wasn't always what it should be. Luckily when I ran the checksum it failed, otherwise I problably would have never realized this. Reading the start of each packet was working, as did reading the expected number of bytes after the start of the packet. "Works" is a loose term, it was returning data, just not what I expected.
No comments:
Post a Comment