C# Class Microsoft.Protocols.TestSuites.SharedAdapter.LittleEndianBitConverter

Implement a converter which converts to/from little-endian byte arrays.
Show file Open project: OfficeDev/Interop-TestSuites Class Usage Examples

Public Methods

Method Description
GetBytes ( int value ) : byte[]

Returns the specified 32-bit signed integer value as an array of bytes.

GetBytes ( uint value ) : byte[]

Returns the specified 32-bit unsigned integer value as an array of bytes.

GetBytes ( ulong value ) : byte[]

Returns the specified 64-bit unsigned integer value as an array of bytes.

GetBytes ( ushort value ) : byte[]

Returns the specified 16-bit unsigned integer value as an array of bytes.

ToInt16 ( byte array, int index ) : short

Returns a 16-bit signed integer converted from two bytes at a specified position in a byte array.

ToInt32 ( byte array, int index ) : int

Returns a 32-bit signed integer converted from two bytes at a specified position in a byte array.

ToUInt16 ( byte array, int index ) : ushort

Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte array.

ToUInt32 ( byte array, int index ) : uint

Returns a 32-bit unsigned integer converted from two bytes at a specified position in a byte array.

ToUInt64 ( byte array, int index ) : ulong

Returns a 64-bit unsigned integer converted from two bytes at a specified position in a byte array.

Private Methods

Method Description
CheckByteArgument ( byte value, int startIndex, int bytesRequired ) : void

This method is used to check the given argument for validity.

ConvertFromBytes ( byte buffer, int startIndex, int bytesToConvert ) : ulong

Returns a value built from the specified number of bytes from the given buffer, starting at index.

ConvertToBytes ( ulong value, byte buffer ) : void

This method is used to convert the specified value to the buffer.

LittleEndianBitConverter ( ) : System

Prevents a default instance of the LittleEndianBitConverter class from being created

Method Details

GetBytes() public static method

Returns the specified 32-bit signed integer value as an array of bytes.
public static GetBytes ( int value ) : byte[]
value int Specify the number to convert.
return byte[]

GetBytes() public static method

Returns the specified 32-bit unsigned integer value as an array of bytes.
public static GetBytes ( uint value ) : byte[]
value uint Specify the number to convert.
return byte[]

GetBytes() public static method

Returns the specified 64-bit unsigned integer value as an array of bytes.
public static GetBytes ( ulong value ) : byte[]
value ulong Specify the number to convert.
return byte[]

GetBytes() public static method

Returns the specified 16-bit unsigned integer value as an array of bytes.
public static GetBytes ( ushort value ) : byte[]
value ushort Specify the number to convert.
return byte[]

ToInt16() public static method

Returns a 16-bit signed integer converted from two bytes at a specified position in a byte array.
public static ToInt16 ( byte array, int index ) : short
array byte Specify an array of bytes.
index int Specify the starting position.
return short

ToInt32() public static method

Returns a 32-bit signed integer converted from two bytes at a specified position in a byte array.
public static ToInt32 ( byte array, int index ) : int
array byte Specify an array of bytes.
index int Specify the starting position.
return int

ToUInt16() public static method

Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte array.
public static ToUInt16 ( byte array, int index ) : ushort
array byte Specify an array of bytes.
index int Specify the starting position.
return ushort

ToUInt32() public static method

Returns a 32-bit unsigned integer converted from two bytes at a specified position in a byte array.
public static ToUInt32 ( byte array, int index ) : uint
array byte Specify an array of bytes.
index int Specify the starting position.
return uint

ToUInt64() public static method

Returns a 64-bit unsigned integer converted from two bytes at a specified position in a byte array.
public static ToUInt64 ( byte array, int index ) : ulong
array byte Specify an array of bytes.
index int Specify the starting position.
return ulong