Class DefaultBufferPool
A concrete IBufferPool implementation backed by the shared ArrayPool<T>. It is thread-safe and handles both fixed and variable size buffer requests. Note: rented buffers may be larger than the requested size (ArrayPool bucketing) and are not cleared on return, so callers must not assume the buffer length equals the requested size.
Inherited Members
Namespace: StreamExtended.BufferPool
Assembly: StreamExtended.dll
Syntax
public sealed class DefaultBufferPool : IBufferPool, IDisposable
Properties
| Edit this page View SourceBufferSize
Buffer size in bytes used throughout this proxy. Default value is 8192 bytes.
Declaration
public int BufferSize { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
| Edit this page View SourceDispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
GetBuffer()
Gets a buffer with a default size.
Declaration
public byte[] GetBuffer()
Returns
| Type | Description |
|---|---|
| byte[] |
GetBuffer(int)
Gets a buffer.
Declaration
public byte[] GetBuffer(int bufferSize)
Parameters
| Type | Name | Description |
|---|---|---|
| int | 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. |