private void CheckSize(int countToAdd) { if ((long)this._maxSize - this.Length < (long)countToAdd) { throw HttpContent.CreateOverCapacityException(this._maxSize); } }
private void EnsureCapacity(int value) { if ((uint)value > (uint)this._maxBufferSize) { throw HttpContent.CreateOverCapacityException(this._maxBufferSize); } if (value <= this._buffer.Length) { return; } this.Grow(value); }
public LimitArrayPoolWriteStream(int maxBufferSize, long capacity) { if (capacity < 256L) { capacity = 256L; } else if (capacity > (long)maxBufferSize) { throw HttpContent.CreateOverCapacityException(maxBufferSize); } this._maxBufferSize = maxBufferSize; this._buffer = ArrayPool <byte> .Shared.Rent((int)capacity); }