Sofu Documentation
Endianness Class
NamespacesSofu.SofuEndianness
Helper class to deal with the many different endianness in binary sofu files. Autodetects input encoding and converts into and from a stream.
Declaration Syntax
C#
public class Endianness
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
Endianness()()()
Create a new endian encoder using machine order

Endianness(Int32)
Create a new encian decoder using a sofu byte order mark.

Endianness(array<Byte>[]()[])
Create a new encian decoder using a sofu byte order mark.

Endianness(Byte, Byte)
Create a new encian decoder using a sofu byte order mark.

BigEndian
Use big endian as Endianness

ByteOrderMark()()()
Returns the byte order mark for this Endianness

ConvertLong(UInt32)
Converts one unsigned integer into a byte array using the current Endianness.

ConvertLong(array<Byte>[]()[])
Converts a bytearray into an unsigned integer using the current Endianness

Equals(Object) (Inherited from Object.)
Finalize()()() (Inherited from Object.)
GetHashCode()()() (Inherited from Object.)
GetType()()() (Inherited from Object.)
Is7BIT()()()
Detects 7 Bit Endianness

LittleEndian
Use little endian as Endianness

MachineOrder
Use this machines default endianess

MemberwiseClone()()() (Inherited from Object.)
Only7Bit
Use integers that don't go over 7 bit. Useful if your transport stream isn't 8 bit safe.

ToString()()() (Inherited from Object.)
Remarks
Endianness supports only 3 encodings for now, those defined in the binary sofu file format: 0, 1: Big Endian1, 0: Little Endian0, 0: 7-Bit Integers
Examples

Convert a some bytes to an integer

CopyC#
byte[] buffer = new byte[2] { 0, 1 }; // Or read it from somewhere
Endianness endian = new Endianness(buffer); // Big Endian, This is in fact a binary sofu header part.
byte[] input = new byte[4] { 0xdd, 0x65, 0xee, 0x47 };
int i = endian.ConvertLong(input);
Console.Out.WriteLine(i); // Writes: 3714444871
Examples

Convert an integer back to some bytes

CopyC#
Endianness endian = Endianness.LittleEndian;
byte[] output = endian.ConvertLong(3714444871); // output is now { 0x47, 0xee, 0x65, 0xdd }
Inheritance Hierarchy
Object
Endianness

Assembly: Sofu (Module: Sofu) Version: 0.2.1.0 (0.2.1.0)