Stores a list of ArraySegments of bytes to be sent over a socket. More...
Public Member Functions | |
void | Add (ArraySegment< byte > entry) |
Add an ArraySegment to the Buffer More... | |
void | Add (byte[] bytes) |
Wrap the provided byte array in an ArraySegment and add it to the Buffer More... | |
long | CopyToArray (ArraySegment< byte > output) |
long | CopyToArray (byte[] output, long offset=0, long count=-1) |
Convert a Buffer to a flat byte array. More... | |
Properties | |
long | Length [get] |
The total length in bytes of all ArraySegments in the buffer More... | |
Stores a list of ArraySegments of bytes to be sent over a socket.
Add bytes or ArraySegments to the BufferView using the Add() methods and then send the BufferView over a socket using the Send() method.
The list of ArraySegments can never be accessed directly. This is to ensure that the backing arrays are only read from to maintain thread-safety.
If you need a mutable copy of the bytes from the buffer you can use the CopyToArray() method.
void NobleConnect.BufferView.Add | ( | ArraySegment< byte > | entry | ) |
Add an ArraySegment to the Buffer
entry |
void NobleConnect.BufferView.Add | ( | byte[] | bytes | ) |
Wrap the provided byte array in an ArraySegment and add it to the Buffer
bytes |
long NobleConnect.BufferView.CopyToArray | ( | ArraySegment< byte > | output | ) |
long NobleConnect.BufferView.CopyToArray | ( | byte[] | output, |
long | offset = 0 , |
||
long | count = -1 |
||
) |
Convert a Buffer to a flat byte array.
buffer |
|
get |
The total length in bytes of all ArraySegments in the buffer