I learned something new today. I was reviewing the new language reference contents and I stumbled across what I thought was a bug in the docs pertaining to BinaryStream. It claimed that the LittleEndian property for a BinaryStream defaults to false. Always. Regardelss of the platform.
I thought, surely this is bunk. I mean, MemoryBlock.LittleEndian defaults to the proper value depending on the platform. BinaryStream must follow suit.
Nope, it doesn't. BinaryStream.LittleEndian defaults to *false* on Windows and Linux. So if you're writing an application that you expect to deploy which requires BinaryStreams to have platform-endianness, make sure you set it up yourself or you're in for a nasty surprise.
The "good" thing about this is if you write a BinaryStream file out, bring it over to another OS and read it back in, it "just works." Basically, it lets you ignore endianness. The downside is that you'll get caught when you try to read files from other applications.
Leave a comment