Innovenergy_trunk/csharp/lib/Protocols/DBus/Transport/DBusBufferWriter.cs

13 lines
454 B
C#

using InnovEnergy.Lib.Protocols.DBus.WireFormat;
namespace InnovEnergy.Lib.Protocols.DBus.Transport;
internal class DBusBufferWriter : DBusWriter
{
public ArraySegment<Byte> Data => _Data.ToArray(); // could be improved, it's pretty efficient tho, uses Array.Copy
private readonly List<Byte> _Data = new List<Byte>();
public override Int32 BytesWritten => _Data.Count;
public override void WriteByte(Byte value) => _Data.Add(value);
}