public UnpooledDirectByteBuf(IByteBufAllocator alloc, int initialCapacity, int maxCapacity) : base(maxCapacity) { if (alloc == null) { throw new NullReferenceException("alloc"); } if (initialCapacity < 0) { throw new ArgumentException("initialCapacity: " + initialCapacity); } if (maxCapacity < 0) { throw new ArgumentException("maxCapacity: " + maxCapacity); } if (initialCapacity > maxCapacity) { throw new ArgumentException(String.Format( "initialCapacity({0}) > maxCapacity({1})", initialCapacity, maxCapacity)); } _alloc = alloc; SetByteBuffer(Convenient.AllocateDirect(initialCapacity)); }