C# Class System.VarintBitConverter

Mostra file Open project: topas/VarintBitConverter

Public Methods

Method Description
GetVarintBytes ( byte value ) : byte[]

Returns the specified byte value as varint encoded array of bytes.

GetVarintBytes ( int value ) : byte[]

Returns the specified 32-bit signed value as varint encoded array of bytes.

GetVarintBytes ( long value ) : byte[]

Returns the specified 64-bit signed value as varint encoded array of bytes.

GetVarintBytes ( short value ) : byte[]

Returns the specified 16-bit signed value as varint encoded array of bytes.

GetVarintBytes ( uint value ) : byte[]

Returns the specified 32-bit unsigned value as varint encoded array of bytes.

GetVarintBytes ( ulong value ) : byte[]

Returns the specified 64-bit unsigned value as varint encoded array of bytes.

GetVarintBytes ( ushort value ) : byte[]

Returns the specified 16-bit unsigned value as varint encoded array of bytes.

ToByte ( byte bytes ) : byte

Returns byte value from varint encoded array of bytes.

ToInt16 ( byte bytes ) : short

Returns 16-bit signed value from varint encoded array of bytes.

ToInt32 ( byte bytes ) : int

Returns 32-bit signed value from varint encoded array of bytes.

ToInt64 ( byte bytes ) : long

Returns 64-bit signed value from varint encoded array of bytes.

ToUInt16 ( byte bytes ) : ushort

Returns 16-bit usigned value from varint encoded array of bytes.

ToUInt32 ( byte bytes ) : uint

Returns 32-bit unsigned value from varint encoded array of bytes.

ToUInt64 ( byte bytes ) : ulong

Returns 64-bit unsigned value from varint encoded array of bytes.

Private Methods

Method Description
DecodeZigZag ( ulong value ) : long
EncodeZigZag ( long value, int bitLength ) : long
ToTarget ( byte bytes, int sizeBites ) : ulong

Method Details

GetVarintBytes() public static method

Returns the specified byte value as varint encoded array of bytes.
public static GetVarintBytes ( byte value ) : byte[]
value byte Byte value
return byte[]

GetVarintBytes() public static method

Returns the specified 32-bit signed value as varint encoded array of bytes.
public static GetVarintBytes ( int value ) : byte[]
value int 32-bit signed value
return byte[]

GetVarintBytes() public static method

Returns the specified 64-bit signed value as varint encoded array of bytes.
public static GetVarintBytes ( long value ) : byte[]
value long 64-bit signed value
return byte[]

GetVarintBytes() public static method

Returns the specified 16-bit signed value as varint encoded array of bytes.
public static GetVarintBytes ( short value ) : byte[]
value short 16-bit signed value
return byte[]

GetVarintBytes() public static method

Returns the specified 32-bit unsigned value as varint encoded array of bytes.
public static GetVarintBytes ( uint value ) : byte[]
value uint 32-bit unsigned value
return byte[]

GetVarintBytes() public static method

Returns the specified 64-bit unsigned value as varint encoded array of bytes.
public static GetVarintBytes ( ulong value ) : byte[]
value ulong 64-bit unsigned value
return byte[]

GetVarintBytes() public static method

Returns the specified 16-bit unsigned value as varint encoded array of bytes.
public static GetVarintBytes ( ushort value ) : byte[]
value ushort 16-bit unsigned value
return byte[]

ToByte() public static method

Returns byte value from varint encoded array of bytes.
public static ToByte ( byte bytes ) : byte
bytes byte Varint encoded array of bytes.
return byte

ToInt16() public static method

Returns 16-bit signed value from varint encoded array of bytes.
public static ToInt16 ( byte bytes ) : short
bytes byte Varint encoded array of bytes.
return short

ToInt32() public static method

Returns 32-bit signed value from varint encoded array of bytes.
public static ToInt32 ( byte bytes ) : int
bytes byte Varint encoded array of bytes.
return int

ToInt64() public static method

Returns 64-bit signed value from varint encoded array of bytes.
public static ToInt64 ( byte bytes ) : long
bytes byte Varint encoded array of bytes.
return long

ToUInt16() public static method

Returns 16-bit usigned value from varint encoded array of bytes.
public static ToUInt16 ( byte bytes ) : ushort
bytes byte Varint encoded array of bytes.
return ushort

ToUInt32() public static method

Returns 32-bit unsigned value from varint encoded array of bytes.
public static ToUInt32 ( byte bytes ) : uint
bytes byte Varint encoded array of bytes.
return uint

ToUInt64() public static method

Returns 64-bit unsigned value from varint encoded array of bytes.
public static ToUInt64 ( byte bytes ) : ulong
bytes byte Varint encoded array of bytes.
return ulong