Class MessageReader
Represents a reader for reading messages from a byte buffer.
public class MessageReader
- Inheritance
-
MessageReader
- Inherited Members
Constructors
MessageReader(byte[])
Initializes a new instance of the MessageReader class with the specified buffer.
public MessageReader(byte[] buffer)
Parameters
buffer
byte[]The byte buffer to read from.
Properties
Type
Gets the type of the message being read.
public MessageType Type { get; }
Property Value
Methods
ReadBool()
Reads a boolean from the buffer.
public bool ReadBool()
Returns
- bool
The boolean read from the buffer
ReadByte()
Reads a byte from the buffer.
public byte ReadByte()
Returns
- byte
The byte read from the buffer
ReadBytes(byte[], int, int)
Writes the specified amount of bytes to the provided buffer.
public void ReadBytes(byte[] buffer, int offset, int length)
Parameters
buffer
byte[]The buffer to write the bytes to.
offset
intThe offset at which to write the bytes in the output buffer.
length
intThe amount of bytes to write to the buffer.
ReadDouble()
Reads a 32-bit signed double from the buffer.
public double ReadDouble()
Returns
- double
The double read from the buffer.
ReadFloat()
Reads a 32-bit signed float from the buffer.
public float ReadFloat()
Returns
- float
The float read from the buffer.
ReadInt16()
Reads a 16-bit signed integer from the buffer.
public int ReadInt16()
Returns
- int
The 16-bit signed integer read from the buffer.
ReadInt32()
Reads a 32-bit signed integer from the buffer.
public int ReadInt32()
Returns
- int
The 32-bit signed integer read from the buffer.
ReadString()
Reads a string from the buffer.
public string ReadString()
Returns
- string
The string read from the buffer.
ReadUInt16()
Reads a 16-bit unsigned integer from the buffer.
public uint ReadUInt16()
Returns
- uint
The 16-bit unsigned integer read from the buffer.
ReadUInt32()
Reads a 32-bit unsigned integer from the buffer.
public uint ReadUInt32()
Returns
- uint
The 32-bit unsigned integer read from the buffer.
Seek(int)
Sets the current position in the buffer to the specified offset.
public void Seek(int offset)
Parameters
offset
intThe offset to seek to.
ToWriter()
Creates a new MessageWriter instance with the same message type as this reader.
public MessageWriter ToWriter()
Returns
- MessageWriter
A new MessageWriter instance.