Class DefaultBufferPool
A concrete IBufferPool implementation using a thread-safe stack. Works well when all consumers ask for buffers with the same size. If your application would use variable size buffers consider implementing IBufferPool using System.Buffers library from Microsoft.
Inherited Members
Namespace: StreamExtended
Assembly: StreamExtended.dll
Syntax
public class DefaultBufferPool : IBufferPool, IDisposable
Methods
Dispose()
Declaration
public void Dispose()
GetBuffer(Int32)
Gets a buffer.
Declaration
public byte[] GetBuffer(int bufferSize)
Parameters
Type | Name | Description |
---|---|---|
Int32 | bufferSize | Size of the buffer. |
Returns
Type | Description |
---|---|
Byte[] |
ReturnBuffer(Byte[])
Returns the buffer.
Declaration
public void ReturnBuffer(byte[] buffer)
Parameters
Type | Name | Description |
---|---|---|
Byte[] | buffer | The buffer. |