Table of Contents

Class MqttBufferWriter

Namespace
MQTTnet.Formatter
Assembly
MQTTnet.dll

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

bufferSize int
maxBufferSize int

Properties

Length

public int Length { get; }

Property Value

int

Methods

BuildFixedHeader(MqttControlPacketType, byte)

public static byte BuildFixedHeader(MqttControlPacketType packetType, byte flags = 0)

Parameters

packetType MqttControlPacketType
flags byte

Returns

byte

Cleanup()

public void Cleanup()

GetBuffer()

public byte[] GetBuffer()

Returns

byte[]

GetVariableByteIntegerSize(uint)

public static int GetVariableByteIntegerSize(uint value)

Parameters

value uint

Returns

int

Reset(int)

public void Reset(int length)

Parameters

length int

Seek(int)

public void Seek(int position)

Parameters

position int

Write(MqttBufferWriter)

public void Write(MqttBufferWriter propertyWriter)

Parameters

propertyWriter MqttBufferWriter

WriteBinary(byte[])

public void WriteBinary(byte[] value)

Parameters

value byte[]

WriteBinary(byte[], int, int)

public void WriteBinary(byte[] buffer, int offset, int count)

Parameters

buffer byte[]
offset int
count int

WriteByte(byte)

public void WriteByte(byte @byte)

Parameters

byte byte

WriteString(string)

public void WriteString(string value)

Parameters

value string

WriteTwoByteInteger(ushort)

public void WriteTwoByteInteger(ushort value)

Parameters

value ushort

WriteVariableByteInteger(uint)

public void WriteVariableByteInteger(uint value)

Parameters

value uint