I inherited a proprietary file parser written in actionscript. I am converting it to c# and I'm at a loss as to how to handle the following step.
public function transform(input:ByteArray) : ByteArray
var output:ByteArray = new ByteArray();
output.endian = "littleEndian";
The code will copy the data in
output unmodified (since bytes don't have endianness) and afterwards all read operations from the returned
ByteArray will use little endian.
On little endian platforms (x86 for example and nowadays pretty much all OSes ARMs as far as I know) .NET will by default use little endian if you use
BinaryReader for example.
So basically that code in .NET would be to create a
MemoryStream of the bytes and then a
BinaryReader for that stream.
You can check whether the platform on which your C# code is running on is little or big endian by using