ServerToolkit.BufferManagement.ManagedBuffer Class Reference

Represents an efficiently allocated buffer for asynchronous read/write operations. More...

Inherits ServerToolkit.BufferManagement.IBuffer.

Public Member Functions

IList< ArraySegment< byte > > GetSegments ()
 Gets buffer segments that can be passed on to an asynchronous socket operation. More...
 
IList< ArraySegment< byte > > GetSegments (long length)
 Gets buffer segments that can be passed on to an asynchronous socket operation. More...
 
IList< ArraySegment< byte > > GetSegments (long offset, long length)
 Gets buffer segments that can be passed on to an asynchronous socket operation. More...
 
void CopyTo (byte[] destinationArray)
 Copies data from the buffer to a byte array. More...
 
void CopyTo (byte[] destinationArray, long destinationIndex, long length)
 Copies data from the buffer to a byte array More...
 
void CopyFrom (byte[] sourceArray)
 Copies data from a byte array into the buffer. More...
 
void CopyFrom (byte[] sourceArray, long sourceIndex, long length)
 Copies data from a byte array into the buffer. More...
 
void FillWith (byte[] sourceArray)
 Copies data from a byte array into the buffer. More...
 
void FillWith (byte[] sourceArray, long sourceIndex, long length)
 Copies data from a byte array into the buffer. More...
 
void Dispose ()
 Releases resources used by the buffer. More...
 

Properties

bool IsDisposed [get]
 Gets a value indicating whether the buffer is disposed. More...
 
long Size [get]
 Gets the total size of the buffer, in bytes. More...
 
int? SegmentCount [get]
 Gets the number of segments in the buffer. More...
 
- Properties inherited from ServerToolkit.BufferManagement.IBuffer
long Size [get]
 Gets the total size of the buffer, in bytes. More...
 
bool IsDisposed [get]
 Gets a value indicating whether the buffer is disposed. More...
 
int SegmentCount [get]
 Gets the number of segments in the buffer. More...
 

Detailed Description

Represents an efficiently allocated buffer for asynchronous read/write operations.

Member Function Documentation

◆ CopyFrom() [1/2]

void ServerToolkit.BufferManagement.ManagedBuffer.CopyFrom ( byte[]  sourceArray)

Copies data from a byte array into the buffer.

Parameters
sourceArrayThe one-dimensional byte array that contains the data.

The length of the sourceArray must be less than or equal to the buffer size.

Implements ServerToolkit.BufferManagement.IBuffer.

◆ CopyFrom() [2/2]

void ServerToolkit.BufferManagement.ManagedBuffer.CopyFrom ( byte[]  sourceArray,
long  sourceIndex,
long  length 
)

Copies data from a byte array into the buffer.

Parameters
sourceArrayThe one-dimensional byte array that contains the data.
sourceIndexThe index in the sourceArray at which copying begins.
lengthThe number of bytes to copy.

Implements ServerToolkit.BufferManagement.IBuffer.

◆ CopyTo() [1/2]

void ServerToolkit.BufferManagement.ManagedBuffer.CopyTo ( byte[]  destinationArray)

Copies data from the buffer to a byte array.

Parameters
destinationArrayThe one-dimensional byte array which receives the data.

The size of the buffer must be less than or equal to the destinationArray length.

Implements ServerToolkit.BufferManagement.IBuffer.

◆ CopyTo() [2/2]

void ServerToolkit.BufferManagement.ManagedBuffer.CopyTo ( byte[]  destinationArray,
long  destinationIndex,
long  length 
)

Copies data from the buffer to a byte array

Parameters
destinationArrayThe one-dimensional byte array which receives the data.
destinationIndexThe index in the destinationArray at which storing begins.
lengthThe number of bytes to copy.

Implements ServerToolkit.BufferManagement.IBuffer.

◆ Dispose()

void ServerToolkit.BufferManagement.ManagedBuffer.Dispose ( )

Releases resources used by the buffer.

This method frees the memory blocks used by the buffer.

◆ FillWith() [1/2]

void ServerToolkit.BufferManagement.ManagedBuffer.FillWith ( byte[]  sourceArray)

Copies data from a byte array into the buffer.

Parameters
sourceArrayThe one-dimensional byte array that contains the data.

The length of the sourceArray must be less than or equal to the buffer size.

Implements ServerToolkit.BufferManagement.IBuffer.

◆ FillWith() [2/2]

void ServerToolkit.BufferManagement.ManagedBuffer.FillWith ( byte[]  sourceArray,
long  sourceIndex,
long  length 
)

Copies data from a byte array into the buffer.

Parameters
sourceArrayThe one-dimensional byte array that contains the data.
sourceIndexThe index in the sourceArray at which copying begins.
lengthThe number of bytes to copy.

Implements ServerToolkit.BufferManagement.IBuffer.

◆ GetSegments() [1/3]

IList<ArraySegment<byte> > ServerToolkit.BufferManagement.ManagedBuffer.GetSegments ( )

Gets buffer segments that can be passed on to an asynchronous socket operation.

Returns
A list of ArraySegments(of Byte) containing buffer segments.

Implements ServerToolkit.BufferManagement.IBuffer.

◆ GetSegments() [2/3]

IList<ArraySegment<byte> > ServerToolkit.BufferManagement.ManagedBuffer.GetSegments ( long  length)

Gets buffer segments that can be passed on to an asynchronous socket operation.

Parameters
lengthTotal length of segments.
Returns
A list of ArraySegments(of Byte) containing buffer segments.

Implements ServerToolkit.BufferManagement.IBuffer.

◆ GetSegments() [3/3]

IList<ArraySegment<byte> > ServerToolkit.BufferManagement.ManagedBuffer.GetSegments ( long  offset,
long  length 
)

Gets buffer segments that can be passed on to an asynchronous socket operation.

Parameters
offsetOffset in the buffer where segments start.
lengthTotal length of segments.
Returns
A list of ArraySegments(of Byte) containing buffer segments.

Implements ServerToolkit.BufferManagement.IBuffer.

Property Documentation

◆ IsDisposed

bool ServerToolkit.BufferManagement.ManagedBuffer.IsDisposed
get

Gets a value indicating whether the buffer is disposed.

◆ SegmentCount

int? ServerToolkit.BufferManagement.ManagedBuffer.SegmentCount
get

Gets the number of segments in the buffer.

◆ Size

long ServerToolkit.BufferManagement.ManagedBuffer.Size
get

Gets the total size of the buffer, in bytes.



The documentation for this class was generated from the following file:
  • Stormancer.Unity/Infrastructure/BufferPool/BufferObjects.cs