MongoDB.Bson.IO.ByteBufferFactory.Create C# (CSharp) Метод

Create() публичный статический Метод

Creates a buffer of the specified fixed capacity. Depending on the required capacity, either a SingleChunkBuffer or a MultiChunkBuffer will be created.
public static Create ( MongoDB.Bson.IO.BsonChunkPool chunkPool, int fixedCapacity ) : IByteBuffer
chunkPool MongoDB.Bson.IO.BsonChunkPool The chunk pool.
fixedCapacity int The required capacity.
Результат IByteBuffer
        public static IByteBuffer Create(BsonChunkPool chunkPool, int fixedCapacity)
        {
            if (chunkPool == null)
            {
                throw new ArgumentNullException("pool");
            }
            if (fixedCapacity <= 0)
            {
                throw new ArgumentOutOfRangeException("capacity");
            }

            if (fixedCapacity < chunkPool.ChunkSize)
            {
                var chunk = chunkPool.AcquireChunk();
                return new SingleChunkBuffer(chunk, 0, 0, false);
            }
            else
            {
                var chunksNeeded = ((fixedCapacity - 1) / chunkPool.ChunkSize) + 1;
                var chunks = new List<BsonChunk>(chunksNeeded);
                for (int i = 0; i < chunksNeeded; i++)
                {
                    chunks.Add(chunkPool.AcquireChunk());
                }
                return new MultiChunkBuffer(chunks, 0, 0, false);
            }
        }
ByteBufferFactory