Class ResizableMessage
Base class for messages which size can be changed.
Namespace: OnixS.SimpleBinaryEncoding
Assembly: OnixS.SimpleBinaryEncoding.dll
Syntax
public abstract class ResizableMessage : object
Fields
buffer
Underlying buffer.
Declaration
protected MemoryPointer<byte> buffer
Field Value
Type | Description |
---|---|
MemoryPointer<System.Byte> |
Properties
Buffer
Message buffer.
Declaration
public Span<byte> Buffer { get; }
Property Value
Type | Description |
---|---|
Span<System.Byte> |
MsgSize
Length of the entire message, including the binary header, in the number of bytes.
Declaration
public abstract ushort MsgSize { get; }
Property Value
Type | Description |
---|---|
System.UInt16 |
Methods
Resize(Span<Byte>, Int32, Int32)
Resize message and copy requered data.
Declaration
protected void Resize(Span<byte> bufToResize, int oldSize, int newSize)
Parameters
Type | Name | Description |
---|---|---|
Span<System.Byte> | bufToResize | Buffer to resize. |
System.Int32 | oldSize | Old size of message. |
System.Int32 | newSize | New size of message. |
Exceptions
Type | Condition |
---|---|
BufferOverflowException | Thrown if buffer does not have free space new group. |
Wrap(MemoryPointer<Byte>, Boolean)
Wraps message around the buffer.
Declaration
public void Wrap(MemoryPointer<byte> buffer, bool encode = false)
Parameters
Type | Name | Description |
---|---|---|
MemoryPointer<System.Byte> | buffer | Data buffer. |
System.Boolean | encode | If true, will set header fields and reset optional fields. |
Wrap(MemoryPointer<Byte>, Boolean, Boolean)
Wraps message around the buffer.
Declaration
protected abstract void Wrap(MemoryPointer<byte> buffer, bool encode, bool resetGroups)
Parameters
Type | Name | Description |
---|---|---|
MemoryPointer<System.Byte> | buffer | Data buffer. |
System.Boolean | encode | If true, will set header fields and reset optional fields. |
System.Boolean | resetGroups | If true, will reset repeating groups position. |