C# Class ServerToolkit.BufferManagement.ManagedBuffer

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

Private Properties

Свойство Type Description
CopyFrom void
CopyFrom void
Dispose void
FindBlockWithOffset void
ManagedBuffer System
ManagedBuffer System

Méthodes publiques

Méthode 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

Méthode 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 méthode

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.
Résultat void

CopyTo() public méthode

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.
Résultat void

Dispose() public méthode

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

FillWith() public méthode

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.
Résultat void

FillWith() public méthode

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.
Résultat void

GetSegments() public méthode

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

GetSegments() public méthode

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

GetSegments() public méthode

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.
Résultat IList>