public UnpooledArrayBuffer(IArrayBufferAllocator <T> allocator, T[] initialArray, int offset, int count) : base(count) { Contract.Requires(initialArray != null && initialArray.Length > 0); Contract.Requires(offset >= 0 && count > 0); Contract.Requires((offset + count) <= initialArray.Length); this.Allocator = allocator; this.Array = initialArray; this.Offset = offset; this.Count = count; }
public UnpooledArrayBuffer(IArrayBufferAllocator <T> allocator, T[] initialArray, int readerIndex, int writerIndex, int maxCapacity) : base(maxCapacity) { Contract.Requires(allocator != null); Contract.Requires(initialArray != null); Contract.Requires(initialArray.Length <= maxCapacity); this.Allocator = allocator; this.SetArray(initialArray); this.SetIndex(readerIndex, writerIndex); }
protected AbstractByteBufferTests(bool pooled) { if (pooled) { this.allocator = new PooledArrayBufferAllocator <byte>(); } else { this.allocator = new UnpooledArrayBufferAllocator <byte>(); } this.random = new Random(Environment.TickCount); }
protected AbstractArrayBufferTest(bool pooled) { if (pooled) { this.allocator = new PooledArrayBufferAllocator <byte>(); } else { this.allocator = new UnpooledArrayBufferAllocator <byte>(); } this.buffer = this.allocator.Buffer(Capacity); this.seed = Environment.TickCount; this.random = new Random(this.seed); }
public void Dispose() { if (this.buffer != null) { Assert.True(this.buffer.Release()); Assert.Equal(0, this.buffer.ReferenceCount); try { this.buffer.Release(); } catch (Exception) { // Ignore. } this.buffer = null; } this.allocator = null; }
internal EmptyArrayBuffer(IArrayBufferAllocator <T> allocator) { Contract.Requires(allocator != null); this.Allocator = allocator; }
public UnpooledArrayBuffer(IArrayBufferAllocator <T> allocator, T[] initialArray, int maxCapacity) : this(allocator, initialArray, 0, initialArray.Length, maxCapacity) { }
public UnpooledArrayBuffer(IArrayBufferAllocator <T> allocator, int initialCapacity, int maxCapacity) : this(allocator, new T[initialCapacity], 0, 0, maxCapacity) { }
internal ByteBufferAllocator(IArrayBufferAllocator <byte> arrayAllocator) { Contract.Requires(arrayAllocator != null); this.ArrayAllocator = arrayAllocator; }
public UnpooledArrayBuffer(IArrayBufferAllocator <T> allocator, T[] initialArray, int capacity) : this(allocator, initialArray, 0, capacity) { }