Skip to content

Commit

Permalink
MqttBufferWriter: Add GetWrittenArraySegment method.
Browse files Browse the repository at this point in the history
  • Loading branch information
xljiulang committed Dec 3, 2024
1 parent 0a25ad6 commit 5b2a995
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Source/MQTTnet/Formatter/MqttBufferWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ public ReadOnlyMemory<byte> GetWrittenMemory()
return _buffer.AsMemory(0, Length);
}

public ArraySegment<byte> GetWrittenArraySegment()
{
return new ArraySegment<byte>(_buffer, 0, Length);
}

public static int GetVariableByteIntegerSize(uint value)
{
// From RFC: Table 2.4 Size of Remaining Length field
Expand Down

0 comments on commit 5b2a995

Please sign in to comment.