Class DataBufferStream
A data buffer stream.
Inheritance
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class DataBufferStream
Constructors
DataBufferStream(DataBuffer)
Initializes a new instance of the DataBufferStream class.
Declaration
public DataBufferStream(DataBuffer buffer)
Parameters
Type | Name | Description |
---|---|---|
DataBuffer | buffer | The buffer. |
DataBufferStream(Int32)
Initializes a new instance of the DataBufferStream class.
Declaration
public DataBufferStream(int dataBufferSize)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dataBufferSize | Size of the data buffer. |
DataBufferStream(Int32, Boolean)
Initializes a new instance of the DataBufferStream class.
Declaration
public DataBufferStream(int dataBufferSize, bool littleEndian)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dataBufferSize | Size of the data buffer. |
System.Boolean | littleEndian | Whether the data is little-endian. |
Properties
Available
Gets the available bytes to be read from the DataBuffer.
Declaration
public int Available { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
BitPosition
Gets or sets the bit position within a byte.
Declaration
public byte BitPosition { get; set; }
Property Value
Type | Description |
---|---|
System.Byte |
Buffer
Gets the buffer.
Declaration
public DataBuffer Buffer { get; }
Property Value
Type | Description |
---|---|
DataBuffer |
Length
Gets the buffer length.
Declaration
public int Length { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Position
Gets or sets the position within the stream.
Declaration
public int Position { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
NextByte()
Resets the bit count to 0 and advances to the next byte.
Declaration
public void NextByte()
Peek()
Reads an 8-bit value from the DataBuffer without advancing the Position.
Declaration
public int Peek()
Returns
Type | Description |
---|---|
System.Int32 |
Read(Int32)
Reads the specified length from the DataBuffer and advances the position by the length.
Declaration
public DataBuffer Read(int length)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | length | The length. |
Returns
Type | Description |
---|---|
DataBuffer |
Read1()
Read a single bit and advance the bit position by 1.
Declaration
public bool Read1()
Returns
Type | Description |
---|---|
System.Boolean |
Read15()
Reads an 15-bit value from the DataBuffer and advances the Position by 1 and the BitPosition by 7.
Declaration
public int Read15()
Returns
Type | Description |
---|---|
System.Int32 |
Read16()
Reads an 16-bit value from the DataBuffer and advances the Position by 2.
Declaration
public int Read16()
Returns
Type | Description |
---|---|
System.Int32 |
Read2()
Read a 2-bit value and advance the BitPosition by 2.
Declaration
public int Read2()
Returns
Type | Description |
---|---|
System.Int32 |
Read24()
Reads an 24-bit value from the DataBuffer and advances the Position by 3.
Declaration
public int Read24()
Returns
Type | Description |
---|---|
System.Int32 |
Read3()
Read a 3-bit value and advance the BitPosition by 3.
Declaration
public int Read3()
Returns
Type | Description |
---|---|
System.Int32 |
Read32()
Reads an 32-bit value from the DataBuffer and advances the Position by 4.
Declaration
public long Read32()
Returns
Type | Description |
---|---|
System.Int64 |
Read4()
Read a 4-bit value and advance the BitPosition by 4.
Declaration
public int Read4()
Returns
Type | Description |
---|---|
System.Int32 |
Read40()
Reads an 40-bit value from the DataBuffer and advances the Position by 5.
Declaration
public long Read40()
Returns
Type | Description |
---|---|
System.Int64 |
Read48()
Reads an 48-bit value from the DataBuffer and advances the Position by 6.
Declaration
public long Read48()
Returns
Type | Description |
---|---|
System.Int64 |
Read56()
Reads an 56-bit value from the DataBuffer and advances the Position by 7.
Declaration
public long Read56()
Returns
Type | Description |
---|---|
System.Int64 |
Read64()
Reads an 64-bit value from the DataBuffer and advances the Position by 8.
Declaration
public long Read64()
Returns
Type | Description |
---|---|
System.Int64 |
Read7()
Reads an 7-bit value from the DataBuffer and advances the BitPosition by 7.
Declaration
public int Read7()
Returns
Type | Description |
---|---|
System.Int32 |
Read8()
Reads an 8-bit value from the DataBuffer and advances the Position by 1.
Declaration
public int Read8()
Returns
Type | Description |
---|---|
System.Int32 |
ReadByte()
Reads a single byte from the stream and advances the Position by 1.
Declaration
public int ReadByte()
Returns
Type | Description |
---|---|
System.Int32 |
ReadBytes(Int32)
Read a specified number of bytes from the DataBuffer and advance the Position by that number.
Declaration
public byte[] ReadBytes(int length)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | length | The number of bytes to read. |
Returns
Type | Description |
---|---|
System.Byte[] |
Write(DataBuffer)
Writes the specified buffer to the DataBuffer and advances the Position by the length of the buffer.
Declaration
public DataBufferStream Write(DataBuffer buffer)
Parameters
Type | Name | Description |
---|---|---|
DataBuffer | buffer | The buffer. |
Returns
Type | Description |
---|---|
DataBufferStream |
Write16(Int32)
Writes an 16-bit value to the DataBuffer and advances the Position by 2.
Declaration
public DataBufferStream Write16(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | The value. |
Returns
Type | Description |
---|---|
DataBufferStream |
Write32(Int64)
Writes an 32-bit value to the DataBuffer and advances the Position by 4.
Declaration
public DataBufferStream Write32(long value)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | value | The value. |
Returns
Type | Description |
---|---|
DataBufferStream |
Write64(Int64)
Writes an 64-bit value to the DataBuffer and advances the Position by 8.
Declaration
public DataBufferStream Write64(long value)
Parameters
Type | Name | Description |
---|---|---|
System.Int64 | value | The value. |
Returns
Type | Description |
---|---|
DataBufferStream |
Write8(Int32)
Writes an 8-bit value to the DataBuffer and advances the Position by 1.
Declaration
public DataBufferStream Write8(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | The value. |
Returns
Type | Description |
---|---|
DataBufferStream |
WriteBytes(Byte[])
Writes the specified data to the DataBuffer and advances the Position by the length of the data.
Declaration
public DataBufferStream WriteBytes(byte[] data)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data. |
Returns
Type | Description |
---|---|
DataBufferStream |
WriteBytes(Byte[], Int32, Int32)
Writes the specified data to the DataBuffer and advances the Position by the length.
Declaration
public DataBufferStream WriteBytes(byte[] data, int index, int length)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | data | The data. |
System.Int32 | index | The index. |
System.Int32 | length | The length. |
Returns
Type | Description |
---|---|
DataBufferStream |