Represents an efficiently allocated buffer for asynchronous read/write operations.
Inheritance: IBuffer
Exemplo n.º 1
0
        /// <summary>
        /// Helper method that gets a filled buffer constructed from a list of memory blocks
        /// </summary>
        /// <param name="allocatedBlocks">The memoryblocks that comprise the buffer</param>
        /// <param name="filledWith">If not null, the contents the memory block will be filled with</param>
        /// <returns>An optionally filled IBuffer object</returns>
        private static IBuffer GetFilledBuffer(IList <IMemoryBlock> allocatedBlocks, byte[] filledWith)
        {
            IBuffer newBuffer = new ManagedBuffer(allocatedBlocks);

            if (filledWith != null)
            {
                newBuffer.FillWith(filledWith);
            }
            return(newBuffer);
        }
Exemplo n.º 2
0
 public void BufferConstructorTest()
 {
     IMemoryBlock nullSlab = null;
     ManagedBuffer target = new ManagedBuffer(nullSlab);
 }
Exemplo n.º 3
0
        private static ManagedBuffer GetNewBuffer(IMemorySlab Slab)
        {
            IMemoryBlock allocatedMemoryBlock;
            Slab.TryAllocate(blockSize, out allocatedMemoryBlock);

            ManagedBuffer target = new ManagedBuffer(allocatedMemoryBlock);
            return target;
        }
Exemplo n.º 4
0
 /// <summary>
 /// Helper method that gets a filled buffer constructed from a list of memory blocks
 /// </summary>
 /// <param name="allocatedBlocks">The memoryblocks that comprise the buffer</param>
 /// <param name="filledWith">If not null, the contents the memory block will be filled with</param>
 /// <returns>An optionally filled IBuffer object</returns>
 private static IBuffer GetFilledBuffer(IList<IMemoryBlock> allocatedBlocks, byte[] filledWith)
 {
     IBuffer newBuffer = new ManagedBuffer(allocatedBlocks);
     if (filledWith != null) newBuffer.FillWith(filledWith);
     return newBuffer;
 }
Exemplo n.º 5
0
        //Gets a multi slab buffer
        private static ManagedBuffer GetNewBuffer(IMemorySlab[] Slabs)
        {
            List<IMemoryBlock> blockList = new List<IMemoryBlock>();
            IMemoryBlock allocatedMemoryBlock;

            foreach (var slab in Slabs)
            {
                slab.TryAllocate(blockSize, out allocatedMemoryBlock);
                blockList.Add(allocatedMemoryBlock);
            }

            ManagedBuffer target = new ManagedBuffer(blockList);
            return target;
        }
Exemplo n.º 6
0
 public void BufferConstructorTest2()
 {
     IMemoryBlock[] emptyBlocks = new IMemoryBlock[0];
     ManagedBuffer target = new ManagedBuffer(emptyBlocks);
 }
Exemplo n.º 7
0
 public void BufferConstructorTest()
 {
     IMemoryBlock[] nullBlocks = null;
     ManagedBuffer target = new ManagedBuffer(nullBlocks);
 }