Class MqttBufferWriter
This is a custom implementation of a memory stream which provides only MQTTnet relevant features. The goal is to avoid lots of argument checks like in the original stream. The growth rule is the same as for the original MemoryStream in .net. Also this implementation allows accessing the internal buffer for all platforms and .net framework versions (which is not available at the regular MemoryStream).
public sealed class MqttBufferWriter
- Inheritance
-
MqttBufferWriter
- Inherited Members
Constructors
MqttBufferWriter(int, int)
public MqttBufferWriter(int bufferSize, int maxBufferSize)
Parameters
Properties
Length
public int Length { get; }
Property Value
Methods
BuildFixedHeader(MqttControlPacketType, byte)
public static byte BuildFixedHeader(MqttControlPacketType packetType, byte flags = 0)
Parameters
packetTypeMqttControlPacketTypeflagsbyte
Returns
Cleanup()
public void Cleanup()
GetBuffer()
public byte[] GetBuffer()
Returns
- byte[]
GetVariableByteIntegerSize(uint)
public static int GetVariableByteIntegerSize(uint value)
Parameters
valueuint
Returns
Reset(int)
public void Reset(int length)
Parameters
lengthint
Seek(int)
public void Seek(int position)
Parameters
positionint
Write(MqttBufferWriter)
public void Write(MqttBufferWriter propertyWriter)
Parameters
propertyWriterMqttBufferWriter
WriteBinary(byte[])
public void WriteBinary(byte[] value)
Parameters
valuebyte[]
WriteBinary(byte[], int, int)
public void WriteBinary(byte[] buffer, int offset, int count)
Parameters
WriteByte(byte)
public void WriteByte(byte @byte)
Parameters
bytebyte
WriteString(string)
public void WriteString(string value)
Parameters
valuestring
WriteTwoByteInteger(ushort)
public void WriteTwoByteInteger(ushort value)
Parameters
valueushort
WriteVariableByteInteger(uint)
public void WriteVariableByteInteger(uint value)
Parameters
valueuint