C# Class ServerToolkit.BufferManagement.ManagedBuffer

Represents an efficiently allocated buffer for asynchronous read/write operations.
Inheritance: IBuffer
Datei anzeigen Open project: tenor/ServerToolkit Class Usage Examples

Private Properties

Property Type Description
CopyFrom void
CopyFrom void
Dispose void
FindBlockWithOffset void
ManagedBuffer System
ManagedBuffer System

Public Methods

Method Description
CopyTo ( byte destinationArray ) : void

Copies data from the buffer to a byte array.

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

CopyTo ( byte destinationArray, long destinationIndex, long length ) : void

Copies data from the buffer to a byte array

Dispose ( ) : void

Releases resources used by the buffer.

This method frees the memory blocks used by the buffer.

FillWith ( byte sourceArray ) : void

Copies data from a byte array into the buffer.

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

FillWith ( byte sourceArray, long sourceIndex, long length ) : void

Copies data from a byte array into the buffer.

GetSegments ( ) : IList>

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

GetSegments ( long length ) : IList>

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

GetSegments ( long offset, long length ) : IList>

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

Private Methods

Method Description
CopyFrom ( byte sourceArray ) : void
CopyFrom ( byte sourceArray, long sourceIndex, long length ) : void
Dispose ( bool disposing ) : void

Releases resources used by the buffer.

FindBlockWithOffset ( long offset, int &blockIndex, long &blockOffSet ) : void
ManagedBuffer ( IList allocatedMemoryBlocks ) : System

Initializes a new instance of the ManagedBuffer class, specifying the memory block that the ManagedBuffer reads and writes to.

ManagedBuffer ( IMemorySlab slab ) : System

Initializes a new instance of the ManagedBuffer class, specifying the slab to be associated with the ManagedBuffer. This constructor creates an empty (zero-length) buffer.

Method Details

CopyTo() public method

Copies data from the buffer to a byte array.
The size of the buffer must be less than or equal to the destinationArray length.
public CopyTo ( byte destinationArray ) : void
destinationArray byte The one-dimensional byte array which receives the data.
return void

CopyTo() public method

Copies data from the buffer to a byte array
public CopyTo ( byte destinationArray, long destinationIndex, long length ) : void
destinationArray byte The one-dimensional byte array which receives the data.
destinationIndex long The index in the destinationArray at which storing begins.
length long The number of bytes to copy.
return void

Dispose() public method

Releases resources used by the buffer.
This method frees the memory blocks used by the buffer.
public Dispose ( ) : void
return void

FillWith() public method

Copies data from a byte array into the buffer.
The length of the sourceArray must be less than or equal to the buffer size.
public FillWith ( byte sourceArray ) : void
sourceArray byte The one-dimensional byte array that contains the data.
return void

FillWith() public method

Copies data from a byte array into the buffer.
public FillWith ( byte sourceArray, long sourceIndex, long length ) : void
sourceArray byte The one-dimensional byte array that contains the data.
sourceIndex long The index in the sourceArray at which copying begins.
length long The number of bytes to copy.
return void

GetSegments() public method

Gets buffer segments that can be passed on to an asynchronous socket operation.
public GetSegments ( ) : IList>
return IList>

GetSegments() public method

Gets buffer segments that can be passed on to an asynchronous socket operation.
public GetSegments ( long length ) : IList>
length long Total length of segments.
return IList>

GetSegments() public method

Gets buffer segments that can be passed on to an asynchronous socket operation.
public GetSegments ( long offset, long length ) : IList>
offset long Offset in the buffer where segments start.
length long Total length of segments.
return IList>