예제 #1
0
 private void CheckSize(int countToAdd)
 {
     if ((long)this._maxSize - this.Length < (long)countToAdd)
     {
         throw HttpContent.CreateOverCapacityException(this._maxSize);
     }
 }
예제 #2
0
 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);
 }
예제 #3
0
 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);
 }