Class BitReader
This class provides functionally to read bit-wide values, tracking bitOffset
(in opposite to byte-wide values for regular System.IO.MemoryStream or byte array).
Inheritance
Namespace: Eco.Shared.Utils.Binary
Assembly: Eco.Shared.dll
Syntax
public static class BitReader : Object
Methods
BitReadBoolean(Byte[], ref Int32)
Reads boolean from byte array using bitPosition
. Boolean represented as single bit.
Declaration
public static bool BitReadBoolean(this byte[] buffer, ref int bitPosition)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | byte array. |
System.Int32 | bitPosition | position in array in bits. |
Returns
Type | Description |
---|---|
System.Boolean | boolean value. |
BitReadByte(Byte[], ref Int32)
Reads a byte value from byte array using bitPosition
. It may have offset within a byte.
Declaration
public static byte BitReadByte(this byte[] buffer, ref int bitPosition)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | byte array. |
System.Int32 | bitPosition | position in array in bits. |
Returns
Type | Description |
---|---|
System.Byte | byte value. |
BitReadBytes(Byte[], Int32, ref Int32)
Reads a byte array from a source byte array using bitPosition
. It may have offset within a byte.
Declaration
public static byte[] BitReadBytes(this byte[] buffer, int length, ref int bitPosition)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | source byte array. |
System.Int32 | length | number of bytes to read. |
System.Int32 | bitPosition | position in array in bits. |
Returns
Type | Description |
---|---|
System.Byte[] | result byte array. |
BitReadIPEndPoint(Byte[], ref Int32)
Declaration
public static IPEndPoint BitReadIPEndPoint(this byte[] buffer, ref int bitPosition)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | |
System.Int32 | bitPosition |
Returns
Type | Description |
---|---|
System.Net.IPEndPoint |
BitReadUInt16(Byte[], ref Int32)
Reads a ushort value from byte array using bitPosition
. It may have offset within a byte.
Declaration
public static ushort BitReadUInt16(this byte[] buffer, ref int bitPosition)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | buffer | byte array. |
System.Int32 | bitPosition | position in array in bits. |
Returns
Type | Description |
---|---|
System.UInt16 | ushort value. |