C# Class OpenStory.Common.IO.LittleEndianBitConverter

Provides static methods for converting primitive types to and from little-endian byte representation.
Exibir arquivo Open project: shoftee/OpenStory Class Usage Examples

Public Methods

Method Description
GetBytes ( bool value ) : byte[]

Gets the byte representation of a System.Boolean.

GetBytes ( double value ) : byte[]

Gets the little-endian byte representation of a System.Int64.

GetBytes ( int value ) : byte[]

Gets the little-endian byte representation of a System.Int32.

GetBytes ( long value ) : byte[]

Gets the little-endian byte representation of a System.Int64.

GetBytes ( short value ) : byte[]

Gets the little-endian byte representation of a System.Int16.

GetBytes ( uint value ) : byte[]

Gets the little-endian byte representation of a System.UInt32.

GetBytes ( ulong value ) : byte[]

Gets the little-endian byte representation of a System.UInt64.

GetBytes ( ushort value ) : byte[]

Gets the little-endian byte representation of a System.UInt16.

ToBoolean ( byte array, int startIndex ) : bool

Constructs a System.Boolean from a byte at a given offset in a byte array.

ToDouble ( byte array, int startIndex ) : double

Constructs a System.Double from bytes at a given offset in a byte array.

ToInt16 ( byte array, int startIndex ) : short

Constructs a System.Int16 from bytes at a given offset in a byte array.

ToInt32 ( byte array, int startIndex ) : int

Constructs a System.Int32 from bytes at a given offset in a byte array.

ToInt64 ( byte array, int startIndex ) : long

Constructs a System.Int64 from bytes at a given offset in a byte array.

ToUInt16 ( byte array, int startIndex ) : ushort

Constructs a System.UInt16 from bytes at a given offset in a byte array.

ToUInt32 ( byte array, int startIndex ) : uint

Constructs a System.UInt32 from bytes at a given offset in a byte array.

ToUInt64 ( byte array, int startIndex ) : ulong

Constructs a System.UInt64 from bytes at a given offset in a byte array.

Private Methods

Method Description
CopyBytes ( long value, int count, byte buffer ) : void

Copies the bytes of an integer into the buffer, in little-endian order.

FromBytes ( byte buffer, int offset, int count ) : long

Returns an integer by reading bytes in little-endian byte order.

GetBytes ( long value, int byteCount ) : byte[]

Method Details

GetBytes() public static method

Gets the byte representation of a System.Boolean.
public static GetBytes ( bool value ) : byte[]
value bool The number to convert.
return byte[]

GetBytes() public static method

Gets the little-endian byte representation of a System.Int64.
public static GetBytes ( double value ) : byte[]
value double The number to convert.
return byte[]

GetBytes() public static method

Gets the little-endian byte representation of a System.Int32.
public static GetBytes ( int value ) : byte[]
value int The number to convert.
return byte[]

GetBytes() public static method

Gets the little-endian byte representation of a System.Int64.
public static GetBytes ( long value ) : byte[]
value long The number to convert.
return byte[]

GetBytes() public static method

Gets the little-endian byte representation of a System.Int16.
public static GetBytes ( short value ) : byte[]
value short The number to convert.
return byte[]

GetBytes() public static method

Gets the little-endian byte representation of a System.UInt32.
public static GetBytes ( uint value ) : byte[]
value uint The number to convert.
return byte[]

GetBytes() public static method

Gets the little-endian byte representation of a System.UInt64.
public static GetBytes ( ulong value ) : byte[]
value ulong The number to convert.
return byte[]

GetBytes() public static method

Gets the little-endian byte representation of a System.UInt16.
public static GetBytes ( ushort value ) : byte[]
value ushort The number to convert.
return byte[]

ToBoolean() public static method

Constructs a System.Boolean from a byte at a given offset in a byte array.
public static ToBoolean ( byte array, int startIndex ) : bool
array byte The array with the byte to use.
startIndex int The offset of the byte.
return bool

ToDouble() public static method

Constructs a System.Double from bytes at a given offset in a byte array.
public static ToDouble ( byte array, int startIndex ) : double
array byte The array with the bytes to use.
startIndex int The offset at which the number starts.
return double

ToInt16() public static method

Constructs a System.Int16 from bytes at a given offset in a byte array.
public static ToInt16 ( byte array, int startIndex ) : short
array byte The array with the bytes to use.
startIndex int The offset at which the number starts.
return short

ToInt32() public static method

Constructs a System.Int32 from bytes at a given offset in a byte array.
public static ToInt32 ( byte array, int startIndex ) : int
array byte The array with the bytes to use.
startIndex int The offset at which the number starts.
return int

ToInt64() public static method

Constructs a System.Int64 from bytes at a given offset in a byte array.
public static ToInt64 ( byte array, int startIndex ) : long
array byte The array with the bytes to use.
startIndex int The offset at which the number starts.
return long

ToUInt16() public static method

Constructs a System.UInt16 from bytes at a given offset in a byte array.
public static ToUInt16 ( byte array, int startIndex ) : ushort
array byte The array with the bytes to use.
startIndex int The offset at which the number starts.
return ushort

ToUInt32() public static method

Constructs a System.UInt32 from bytes at a given offset in a byte array.
public static ToUInt32 ( byte array, int startIndex ) : uint
array byte The array with the bytes to use.
startIndex int The offset at which the number starts.
return uint

ToUInt64() public static method

Constructs a System.UInt64 from bytes at a given offset in a byte array.
public static ToUInt64 ( byte array, int startIndex ) : ulong
array byte The array with the bytes to use.
startIndex int The offset at which the number starts.
return ulong