C# Class GSF.Encoding7Bit

Contains 7 bit encoding functions
Mostrar archivo Open project: GridProtectionAlliance/gsf

Public Methods

Method Description
GetSize ( uint value1 ) : int

Gets the number of bytes required to write the provided value.

GetSize ( ulong value1 ) : int

Gets the number of bytes required to write the provided value.

GetSizeInt15 ( short value1 ) : int

Gets the number of bytes required to write the provided value.

Measure15 ( byte stream, int position ) : int

Gets the number of bytes for the supplied value in the stream.

MeasureInt15 ( byte stream ) : int

Gets the number of bytes for the supplied value in the stream.

MeasureUInt32 ( byte stream ) : int

Gets the number of bytes for the supplied value in the stream.

MeasureUInt32 ( byte stream, int position ) : int

Gets the number of bytes for the supplied value in the stream.

MeasureUInt64 ( byte stream ) : int

Gets the number of bytes for the supplied value in the stream.

MeasureUInt64 ( byte stream, int position ) : int

Gets the number of bytes for the supplied value in the stream.

ReadInt15 ( Func stream ) : short

Reads a 7-bit encoded uint.

ReadInt15 ( Stream stream ) : short

Reads a 7-bit encoded uint.

This method will check for the end of the stream

ReadUInt32 ( Func stream ) : uint

Reads a 7-bit encoded uint.

ReadUInt32 ( Stream stream ) : uint

Reads a 7-bit encoded uint.

This method will check for the end of the stream

ReadUInt64 ( Func stream ) : ulong

Reads a 7-bit encoded uint.

ReadUInt64 ( Stream stream ) : ulong

Reads a 7-bit encoded ulong.

This method will check for the end of the stream

Write ( Action stream, uint value1 ) : void

Writes the 7-bit encoded value to the provided stream.

Write ( Action stream, ulong value1 ) : void

Writes the 7-bit encoded value to the provided stream.

WriteInt15 ( Action stream, short value1 ) : void

Writes the 7-bit encoded value to the provided stream.

Private Methods

Method Description
ReadInt15 ( byte stream, int &position ) : short
ReadUInt32 ( byte stream, int &position ) : uint
ReadUInt64 ( byte stream, int &position ) : ulong
Write ( byte stream, uint value1 ) : int
Write ( byte stream, ulong value1 ) : int
Write ( byte stream, int &position, uint value1 ) : void
Write ( byte stream, int &position, ulong value1 ) : void
WriteInt15 ( byte stream, short value1 ) : int
WriteInt15 ( byte stream, int &position, short value1 ) : void

Method Details

GetSize() public static method

Gets the number of bytes required to write the provided value.
public static GetSize ( uint value1 ) : int
value1 uint the value to measure
return int

GetSize() public static method

Gets the number of bytes required to write the provided value.
public static GetSize ( ulong value1 ) : int
value1 ulong the value to measure
return int

GetSizeInt15() public static method

Gets the number of bytes required to write the provided value.
public static GetSizeInt15 ( short value1 ) : int
value1 short the value to measure
return int

Measure15() public static method

Gets the number of bytes for the supplied value in the stream.
public static Measure15 ( byte stream, int position ) : int
stream byte
position int
return int

MeasureInt15() public static method

Gets the number of bytes for the supplied value in the stream.
public static MeasureInt15 ( byte stream ) : int
stream byte
return int

MeasureUInt32() public static method

Gets the number of bytes for the supplied value in the stream.
public static MeasureUInt32 ( byte stream ) : int
stream byte
return int

MeasureUInt32() public static method

Gets the number of bytes for the supplied value in the stream.
public static MeasureUInt32 ( byte stream, int position ) : int
stream byte
position int
return int

MeasureUInt64() public static method

Gets the number of bytes for the supplied value in the stream.
public static MeasureUInt64 ( byte stream ) : int
stream byte
return int

MeasureUInt64() public static method

Gets the number of bytes for the supplied value in the stream.
public static MeasureUInt64 ( byte stream, int position ) : int
stream byte
position int
return int

ReadInt15() public static method

Reads a 7-bit encoded uint.
public static ReadInt15 ( Func stream ) : short
stream Func A delegate where to read the next byte
return short

ReadInt15() public static method

Reads a 7-bit encoded uint.
This method will check for the end of the stream
Occurs if the end of the stream was reached.
public static ReadInt15 ( Stream stream ) : short
stream Stream A stream to read from.
return short

ReadUInt32() public static method

Reads a 7-bit encoded uint.
public static ReadUInt32 ( Func stream ) : uint
stream Func A delegate where to read the next byte
return uint

ReadUInt32() public static method

Reads a 7-bit encoded uint.
This method will check for the end of the stream
Occurs if the end of the stream was reached.
public static ReadUInt32 ( Stream stream ) : uint
stream Stream A stream to read from.
return uint

ReadUInt64() public static method

Reads a 7-bit encoded uint.
public static ReadUInt64 ( Func stream ) : ulong
stream Func A delegate where to read the next byte
return ulong

ReadUInt64() public static method

Reads a 7-bit encoded ulong.
This method will check for the end of the stream
Occurs if the end of the stream was reached.
public static ReadUInt64 ( Stream stream ) : ulong
stream Stream A stream to read from.
return ulong

Write() public static method

Writes the 7-bit encoded value to the provided stream.
public static Write ( Action stream, uint value1 ) : void
stream Action a delegate to a write byte method
value1 uint the value to write
return void

Write() public static method

Writes the 7-bit encoded value to the provided stream.
public static Write ( Action stream, ulong value1 ) : void
stream Action a delegate to a write byte method
value1 ulong the value to write
return void

WriteInt15() public static method

Writes the 7-bit encoded value to the provided stream.
public static WriteInt15 ( Action stream, short value1 ) : void
stream Action a delegate to a write byte method
value1 short the value to write
return void