>Eureka! A working .map reader

>Ok.. overly technical post, but it may be useful to anyone who’s writing java code, and trying to read binary files.

  1. Don’t use a BufferedReader wrapped around your FileInputStream. It modifies the values of the data you get!
  2. x86 processors are little endian: when you read in four bytes, you have to add them together in the reverse order to create an int.
  3. Java doesn’t use unsigned variables, so you’ll have to AND all your bytes with 0xff and cast to int to get the correct value.

I’ll just chalk this up to Lessons learned.

Leave a Reply

Your email address will not be published. Required fields are marked *