Diffusion .NET Client Library  6.1.5
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
PushTechnology.ClientInterface.FlexibleBitConverter Class Reference

The collection of methods for converting an array of bytes to one of the base data types, as well as for converting a base data type to an array of bytes. More...

Static Public Member Functions

static unsafe void GetBytes (short value, byte[] result, int offset, ByteOrder resultByteOrder)
 Writes the specified 16-bit signed integer value into the given byte array. More...
 
static byte[] GetBytes (short value, ByteOrder resultByteOrder)
 Returns the specified 16-bit signed integer value as an array of bytes. More...
 
static void GetBytes (char value, byte[] result, int offset, ByteOrder resultByteOrder)
 Writes the specified 16-bit character value into the given byte array. More...
 
static byte[] GetBytes (char value, ByteOrder resultByteOrder)
 Returns the specified 16-bit character value as an array of bytes. More...
 
static unsafe void GetBytes (int value, byte[] result, int offset, ByteOrder resultByteOrder)
 Writes the specified 32-bit signed integer value into the given byte array. More...
 
static byte[] GetBytes (int value, ByteOrder resultByteOrder)
 Returns the specified 32-bit signed integer value as an array of bytes. More...
 
static unsafe void GetBytes (long value, byte[] result, int offset, ByteOrder resultByteOrder)
 Writes the specified 64-bit signed integer value into the given byte array. More...
 
static byte[] GetBytes (long value, ByteOrder resultByteOrder)
 Returns the specified 64-bit signed integer value as an array of bytes. More...
 
static void GetBytes (ushort value, byte[] result, int offset, ByteOrder resultByteOrder)
 Writes the specified 16-bit unsigned integer value into the given byte array. More...
 
static byte[] GetBytes (ushort value, ByteOrder resultByteOrder)
 Returns the specified 16-bit unsigned integer value as an array of bytes. More...
 
static void GetBytes (uint value, byte[] result, int offset, ByteOrder resultByteOrder)
 Writes the specified 32-bit unsigned integer value into the given byte array. More...
 
static byte[] GetBytes (uint value, ByteOrder resultByteOrder)
 Returns the specified 32-bit unsigned integer value as an array of bytes. More...
 
static void GetBytes (ulong value, byte[] result, int offset, ByteOrder resultByteOrder)
 Writes the specified 64-bit unsigned integer value into the given byte array. More...
 
static byte[] GetBytes (ulong value, ByteOrder resultByteOrder)
 Returns the specified 64-bit unsigned integer value as an array of bytes. More...
 
static unsafe void GetBytes (float value, byte[] result, int offset, ByteOrder resultByteOrder)
 Writes the specified 32-bit floating point value into the given byte array. More...
 
static unsafe byte[] GetBytes (float value, ByteOrder resultByteOrder)
 Returns the specified 32-bit floating point value as an array of bytes. More...
 
static unsafe void GetBytes (double value, byte[] result, int offset, ByteOrder resultByteOrder)
 Writes the specified 64-bit floating point value into the given byte array. More...
 
static unsafe byte[] GetBytes (double value, ByteOrder resultByteOrder)
 Returns the specified 64-bit floating point value as an array of bytes. More...
 
static char ToChar (byte[] value, int offset, ByteOrder valueByteOrder)
 Returns a 16-bit character converted from two bytes at a specified position in a byte array. More...
 
static unsafe short ToInt16 (byte[] value, int offset, ByteOrder valueByteOrder)
 Returns a 16-bit signed integer converted from two bytes at a specified position in a byte array. More...
 
static unsafe int ToInt32 (byte[] value, int offset, ByteOrder valueByteOrder)
 Returns a 32-bit signed integer converted from four bytes at a specified position in a byte array. More...
 
static unsafe long ToInt64 (byte[] value, int offset, ByteOrder valueByteOrder)
 Returns a 64-bit signed integer converted from eight bytes at a specified position in a byte array. More...
 
static ushort ToUInt16 (byte[] value, int offset, ByteOrder valueByteOrder)
 Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte array. More...
 
static uint ToUInt32 (byte[] value, int offset, ByteOrder valueByteOrder)
 Returns a 32-bit unsigned integer converted from four bytes at a specified position in a byte array. More...
 
static ulong ToUInt64 (byte[] value, int offset, ByteOrder valueByteOrder)
 Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a byte array. More...
 
static float ToHalf (byte[] value, int offset, ByteOrder valueByteOrder)
 Returns a 16-bit floating point converted from eight bytes at a specified position in a byte array. More...
 
static unsafe float ToSingle (byte[] value, int offset, ByteOrder valueByteOrder)
 Returns a 32-bit floating point converted from eight bytes at a specified position in a byte array. More...
 
static unsafe double ToDouble (byte[] value, int offset, ByteOrder valueByteOrder)
 Returns a 64-bit floating point converted from eight bytes at a specified position in a byte array. More...
 

Static Public Attributes

static ByteOrder SystemByteOrder
 Returns the byte order of the current architecture. More...
 

Detailed Description

The collection of methods for converting an array of bytes to one of the base data types, as well as for converting a base data type to an array of bytes.

All methods are able to distinguish between little-endian and big-endian byte ordering.

Member Function Documentation

static unsafe void PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( short  value,
byte[]  result,
int  offset,
ByteOrder  resultByteOrder 
)
static

Writes the specified 16-bit signed integer value into the given byte array.

Parameters
valueThe value to convert.
resultThe byte array to write the integer to.
offsetThe starting index of the result buffer.
resultByteOrderThe byte order for the resulting array.
Exceptions
ArgumentNullExceptionThe given result array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given result array.
static byte [] PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( short  value,
ByteOrder  resultByteOrder 
)
static

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

Parameters
valueThe value to convert.
resultByteOrderThe byte order for the resulting array.
Returns
An array of bytes with length 2.
static void PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( char  value,
byte[]  result,
int  offset,
ByteOrder  resultByteOrder 
)
static

Writes the specified 16-bit character value into the given byte array.

Parameters
valueThe value to convert.
resultThe byte array to write the character to.
offsetThe starting index of the result buffer.
resultByteOrderThe byte order for the resulting array.
Exceptions
ArgumentNullExceptionThe given result array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given result array.
static byte [] PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( char  value,
ByteOrder  resultByteOrder 
)
static

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

Parameters
valueThe value to convert.
resultByteOrderThe byte order for the resulting array.
Returns
An array of bytes with length 2.
static unsafe void PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( int  value,
byte[]  result,
int  offset,
ByteOrder  resultByteOrder 
)
static

Writes the specified 32-bit signed integer value into the given byte array.

Parameters
valueThe value to convert.
resultThe byte array to write the integer to.
offsetThe starting index of the result buffer.
resultByteOrderThe byte order for the resulting array.
Exceptions
ArgumentNullExceptionThe given result array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given result array.
static byte [] PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( int  value,
ByteOrder  resultByteOrder 
)
static

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

Parameters
valueThe value to convert.
resultByteOrderThe byte order for the resulting array.
Returns
An array of bytes with length 4.
static unsafe void PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( long  value,
byte[]  result,
int  offset,
ByteOrder  resultByteOrder 
)
static

Writes the specified 64-bit signed integer value into the given byte array.

Parameters
valueThe value to convert.
resultThe byte array to write the integer to.
offsetThe starting index of the result buffer.
resultByteOrderThe byte order for the resulting array.
Exceptions
ArgumentNullExceptionThe given result array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given result array.
static byte [] PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( long  value,
ByteOrder  resultByteOrder 
)
static

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

Parameters
valueThe value to convert.
resultByteOrderThe byte order for the resulting array.
Returns
An array of bytes with length 8.
static void PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( ushort  value,
byte[]  result,
int  offset,
ByteOrder  resultByteOrder 
)
static

Writes the specified 16-bit unsigned integer value into the given byte array.

Parameters
valueThe value to convert.
resultThe byte array to write the integer to.
offsetThe starting index of the result buffer.
resultByteOrderThe byte order for the resulting array.
Exceptions
ArgumentNullExceptionThe given result array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given result array.
static byte [] PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( ushort  value,
ByteOrder  resultByteOrder 
)
static

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

Parameters
valueThe value to convert.
resultByteOrderThe byte order for the resulting array.
Returns
An array of bytes with length 2.
static void PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( uint  value,
byte[]  result,
int  offset,
ByteOrder  resultByteOrder 
)
static

Writes the specified 32-bit unsigned integer value into the given byte array.

Parameters
valueThe value to convert.
resultThe byte array to write the integer to.
offsetThe starting index of the result buffer.
resultByteOrderThe byte order for the resulting array.
Exceptions
ArgumentNullExceptionThe given result array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given result array.
static byte [] PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( uint  value,
ByteOrder  resultByteOrder 
)
static

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

Parameters
valueThe value to convert.
resultByteOrderThe byte order for the resulting array.
Returns
An array of bytes with length 4.
static void PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( ulong  value,
byte[]  result,
int  offset,
ByteOrder  resultByteOrder 
)
static

Writes the specified 64-bit unsigned integer value into the given byte array.

Parameters
valueThe value to convert.
resultThe byte array to write the integer to.
offsetThe starting index of the result buffer.
resultByteOrderThe byte order for the resulting array.
Exceptions
ArgumentNullExceptionThe given result array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given result array.
static byte [] PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( ulong  value,
ByteOrder  resultByteOrder 
)
static

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

Parameters
valueThe value to convert.
resultByteOrderThe byte order for the resulting array.
Returns
An array of bytes with length 8.
static unsafe void PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( float  value,
byte[]  result,
int  offset,
ByteOrder  resultByteOrder 
)
static

Writes the specified 32-bit floating point value into the given byte array.

Parameters
valueThe value to convert.
resultThe byte array to write the floating point to.
offsetThe starting index of the result buffer.
resultByteOrderThe byte order for the resulting array.
Exceptions
ArgumentNullExceptionThe given result array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given result array.
static unsafe byte [] PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( float  value,
ByteOrder  resultByteOrder 
)
static

Returns the specified 32-bit floating point value as an array of bytes.

Parameters
valueThe value to convert.
resultByteOrderThe byte order for the resulting array.
Returns
An array of bytes with length 4.
static unsafe void PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( double  value,
byte[]  result,
int  offset,
ByteOrder  resultByteOrder 
)
static

Writes the specified 64-bit floating point value into the given byte array.

Parameters
valueThe value to convert.
resultThe byte array to write the floating point to.
offsetThe starting index of the result buffer.
resultByteOrderThe byte order for the resulting array.
Exceptions
ArgumentNullExceptionThe given result array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given result array.
static unsafe byte [] PushTechnology.ClientInterface.FlexibleBitConverter.GetBytes ( double  value,
ByteOrder  resultByteOrder 
)
static

Returns the specified 64-bit floating point value as an array of bytes.

Parameters
valueThe value to convert.
resultByteOrderThe byte order for the resulting array.
Returns
An array of bytes with length 8.
static char PushTechnology.ClientInterface.FlexibleBitConverter.ToChar ( byte[]  value,
int  offset,
ByteOrder  valueByteOrder 
)
static

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

Parameters
valueThe byte array to read the character from.
offsetThe starting index of the character within the byte array.
valueByteOrderThe byte order of the given byte array.
Returns
A 16-bit character formed by two bytes beginning at offset .
Exceptions
ArgumentNullExceptionThe given array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given array.
static unsafe double PushTechnology.ClientInterface.FlexibleBitConverter.ToDouble ( byte[]  value,
int  offset,
ByteOrder  valueByteOrder 
)
static

Returns a 64-bit floating point converted from eight bytes at a specified position in a byte array.

Parameters
valueThe byte array to read the floating point from.
offsetThe starting index of the floating point within the byte array.
valueByteOrderThe byte order of the given byte array.
Returns
A 64-bit floating point formed by eight bytes beginning at offset .
Exceptions
ArgumentNullExceptionThe given array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given array.
static float PushTechnology.ClientInterface.FlexibleBitConverter.ToHalf ( byte[]  value,
int  offset,
ByteOrder  valueByteOrder 
)
static

Returns a 16-bit floating point converted from eight bytes at a specified position in a byte array.

Parameters
valueThe byte array to read the floating point from.
offsetThe starting index of the floating point within the byte array.
valueByteOrderThe byte order of the given byte array.
Returns
A 16-bit floating point formed by eight bytes beginning at offset .
Exceptions
ArgumentNullExceptionThe given array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given array.
static unsafe short PushTechnology.ClientInterface.FlexibleBitConverter.ToInt16 ( byte[]  value,
int  offset,
ByteOrder  valueByteOrder 
)
static

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

Parameters
valueThe byte array to read the integer from.
offsetThe starting index of the integer within the byte array.
valueByteOrderThe byte order of the given byte array.
Returns
A 16-bit signed integer formed by two bytes beginning at offset .
Exceptions
ArgumentNullExceptionThe given array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given array.
static unsafe int PushTechnology.ClientInterface.FlexibleBitConverter.ToInt32 ( byte[]  value,
int  offset,
ByteOrder  valueByteOrder 
)
static

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

Parameters
valueThe byte array to read the integer from.
offsetThe starting index of the integer within the byte array.
valueByteOrderThe byte order of the given byte array.
Returns
A 32-bit signed integer formed by four bytes beginning at offset .
Exceptions
ArgumentNullExceptionThe given array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given array.
static unsafe long PushTechnology.ClientInterface.FlexibleBitConverter.ToInt64 ( byte[]  value,
int  offset,
ByteOrder  valueByteOrder 
)
static

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

Parameters
valueThe byte array to read the integer from.
offsetThe starting index of the integer within the byte array.
valueByteOrderThe byte order of the given byte array.
Returns
A 64-bit signed integer formed by eight bytes beginning at offset .
Exceptions
ArgumentNullExceptionThe given array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given array.
static unsafe float PushTechnology.ClientInterface.FlexibleBitConverter.ToSingle ( byte[]  value,
int  offset,
ByteOrder  valueByteOrder 
)
static

Returns a 32-bit floating point converted from eight bytes at a specified position in a byte array.

Parameters
valueThe byte array to read the floating point from.
offsetThe starting index of the floating point within the byte array.
valueByteOrderThe byte order of the given byte array.
Returns
A 32-bit floating point formed by eight bytes beginning at offset .
Exceptions
ArgumentNullExceptionThe given array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given array.
static ushort PushTechnology.ClientInterface.FlexibleBitConverter.ToUInt16 ( byte[]  value,
int  offset,
ByteOrder  valueByteOrder 
)
static

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

Parameters
valueThe byte array to read the integer from.
offsetThe starting index of the integer within the byte array.
valueByteOrderThe byte order of the given byte array.
Returns
A 16-bit unsigned integer formed by two bytes beginning at offset .
Exceptions
ArgumentNullExceptionThe given array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given array.
static uint PushTechnology.ClientInterface.FlexibleBitConverter.ToUInt32 ( byte[]  value,
int  offset,
ByteOrder  valueByteOrder 
)
static

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

Parameters
valueThe byte array to read the integer from.
offsetThe starting index of the integer within the byte array.
valueByteOrderThe byte order of the given byte array.
Returns
A 32-bit unsigned integer formed by four bytes beginning at offset .
Exceptions
ArgumentNullExceptionThe given array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given array.
static ulong PushTechnology.ClientInterface.FlexibleBitConverter.ToUInt64 ( byte[]  value,
int  offset,
ByteOrder  valueByteOrder 
)
static

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

Parameters
valueThe byte array to read the integer from.
offsetThe starting index of the integer within the byte array.
valueByteOrderThe byte order of the given byte array.
Returns
A 64-bit signed integer formed by eight bytes beginning at offset .
Exceptions
ArgumentNullExceptionThe given array is null.
ArgumentOutOfRangeExceptionThe given offset is negative or bigger than the given array.

Member Data Documentation

ByteOrder PushTechnology.ClientInterface.FlexibleBitConverter.SystemByteOrder
static
Initial value:
=>
BitConverter.IsLittleEndian ? ByteOrder.LeastSignificantByte : ByteOrder.MostSignificantByte

Returns the byte order of the current architecture.


The documentation for this class was generated from the following file: