Covnert the body buffer to a memory stream which will grow automatically.

This commit is contained in:
Christian
2018-01-24 20:49:47 +01:00
parent e56203faac
commit 1415e4b878
7 changed files with 57 additions and 42 deletions
@@ -1,11 +1,12 @@
using System;
using System.IO;
using MQTTnet.Packets;
namespace MQTTnet.Adapter
{
public class ReceivedMqttPacket
public sealed class ReceivedMqttPacket : IDisposable
{
public ReceivedMqttPacket(MqttPacketHeader header, byte[] body)
public ReceivedMqttPacket(MqttPacketHeader header, MemoryStream body)
{
Header = header ?? throw new ArgumentNullException(nameof(header));
Body = body ?? throw new ArgumentNullException(nameof(body));
@@ -13,6 +14,11 @@ namespace MQTTnet.Adapter
public MqttPacketHeader Header { get; }
public byte[] Body { get; }
public MemoryStream Body { get; }
public void Dispose()
{
Body?.Dispose();
}
}
}