C# Class SipSharp.Transports.BufferPool

Keeps a pool of byte buffers.
A simple flyweight pattern to avoid frequent allocation of small buffers.
Mostrar archivo Open project: jgauffin/SipSharp

Public Methods

Method Description
BufferPool ( int bufferSize ) : System

Initializes a new instance of the BufferPool class.

Dequeue ( ) : byte[]

Get a buffer.

Will create one if queue is empty.

Enqueue ( byte buffer ) : void

Enqueues the specified buffer.

Private Methods

Method Description
CreateBuffer ( ) : byte[]

Creates the buffer.

Method Details

BufferPool() public method

Initializes a new instance of the BufferPool class.
public BufferPool ( int bufferSize ) : System
bufferSize int How large buffers to allocate.
return System

Dequeue() public method

Get a buffer.
Will create one if queue is empty.
public Dequeue ( ) : byte[]
return byte[]

Enqueue() public method

Enqueues the specified buffer.
Buffer is is less than the minimum requirement.
public Enqueue ( byte buffer ) : void
buffer byte Buffer to enqueue.
return void