June 10, 2012

Java Must Haves #1: LittleEndianDataInputStream

Since I started working for Amazon, I've still been able to work with C# and JavaScript from time to time, but most of my time has been spent neck deep in Java.

Mind you, Java isn't my favorite language. The more I mess around with it, the more it feels like an iceberg of compromise. So, I'm going to start posting links to things that have helped me make Java suck less.

The first involves DataInputStreams. In the "infinite wisdom" of Sun/Oracle, DataInputStreams must be big-endian. The vast majority of data files produced outside of Java on x86/x64 systems are little-endian, and the lack of a little-endian data stream makes file interop a total pain in the ass.

Fortunately, a little-endian stream was created and the code is public domain. Thanks to Peter Franza for creating the code and releasing it.


No comments: