Nakama .NET Client SDK 3.8.0
Nakama .NET Client SDK
Loading...
Searching...
No Matches
Nakama.Ninja.WebSockets.BufferPool Class Reference

This buffer pool is instance thread safe Use GetBuffer to get a MemoryStream (with a publically accessible buffer) Calling Close on this MemoryStream will clear its internal buffer and return the buffer to the pool for reuse MemoryStreams can grow larger than the DEFAULT_BUFFER_SIZE (or whatever you passed in) and the underlying buffers will be returned to the pool at their larger sizes. More...

Inheritance diagram for Nakama.Ninja.WebSockets.BufferPool:
Nakama.Ninja.WebSockets.IBufferPool

Classes

class  PublicBufferMemoryStream
 This memory stream is not instance thread safe (not to be confused with the BufferPool which is instance thread safe) More...
 

Public Member Functions

 BufferPool ()
 
 BufferPool (int bufferSize)
 
MemoryStream GetBuffer ()
 Gets a MemoryStream built from a buffer plucked from a thread safe pool The pool grows automatically. Closing the memory stream clears the buffer and returns it to the pool.
 

Protected Member Functions

void ReturnBuffer (byte[] buffer)
 

Detailed Description

This buffer pool is instance thread safe Use GetBuffer to get a MemoryStream (with a publically accessible buffer) Calling Close on this MemoryStream will clear its internal buffer and return the buffer to the pool for reuse MemoryStreams can grow larger than the DEFAULT_BUFFER_SIZE (or whatever you passed in) and the underlying buffers will be returned to the pool at their larger sizes.

Constructor & Destructor Documentation

◆ BufferPool() [1/2]

Nakama.Ninja.WebSockets.BufferPool.BufferPool ( )
inline

◆ BufferPool() [2/2]

Nakama.Ninja.WebSockets.BufferPool.BufferPool ( int  bufferSize)
inline

Member Function Documentation

◆ GetBuffer()

MemoryStream Nakama.Ninja.WebSockets.BufferPool.GetBuffer ( )
inline

Gets a MemoryStream built from a buffer plucked from a thread safe pool The pool grows automatically. Closing the memory stream clears the buffer and returns it to the pool.

Implements Nakama.Ninja.WebSockets.IBufferPool.

◆ ReturnBuffer()

void Nakama.Ninja.WebSockets.BufferPool.ReturnBuffer ( byte[]  buffer)
inlineprotected

The documentation for this class was generated from the following file: