BitArrayReader

Ecng.Collections

Provides a reader for bit-level data from a stream.

Constructors

BitArrayReader
public BitArrayReader(byte[] underlyingData)
bitArrayReader = BitArrayReader(underlyingData)

Initializes a new instance of the BitArrayReader class with the specified underlying stream.

underlyingData
The stream to read bit-level data from.
BitArrayReader
public BitArrayReader(Stream underlyingStream)
bitArrayReader = BitArrayReader(underlyingStream)

Initializes a new instance of the BitArrayReader class with the specified underlying stream.

underlyingStream
The stream to read bit-level data from.

Properties

Offset
public long Offset { get; set; }
value = bitArrayReader.Offset
bitArrayReader.Offset = value

Gets or sets the current bit offset within the stream.

Methods

Get
private ulong Get(long offset)
result = bitArrayReader.Get(offset)

Retrieves the 64-bit value at the specified offset.

offset
The offset to read from.

Returns: The 64-bit value at the specified offset.

Read
public bool Read()
result = bitArrayReader.Read()

Reads a single bit from the stream.

Returns: The value of the bit read.

Read
public int Read(int count)
result = bitArrayReader.Read(count)

Reads a specified number of bits from the stream as an integer.

count
The number of bits to read.

Returns: The integer value represented by the bits read.

ReadArray
public bool[] ReadArray(int count)
result = bitArrayReader.ReadArray(count)

Reads an array of bits from the stream.

count
The number of bits to read.

Returns: An array of boolean values representing the bits read.

ReadDecimal
public decimal ReadDecimal()
result = bitArrayReader.ReadDecimal()

Reads a decimal value from the stream.

Returns: The decimal value read from the stream.

ReadInt
public int ReadInt()
result = bitArrayReader.ReadInt()

Reads an integer value from the stream using a variable-length encoding.

Returns: The integer value read from the stream.

ReadLong
public long ReadLong(int count)
result = bitArrayReader.ReadLong(count)

Reads a specified number of bits from the stream as a long integer.

count
The number of bits to read.

Returns: The long integer value represented by the bits read.

ReadLong
public long ReadLong()
result = bitArrayReader.ReadLong()

Reads a long integer value from the stream using a variable-length encoding.

Returns: The long integer value read from the stream.

Seek
public void Seek(int offset)
bitArrayReader.Seek(offset)

Moves the current bit offset by the specified number of bits.

offset
The number of bits to move the offset by.