示例#1
0
        private void RequireBuffer(int minBytes)
        {
            var requiredSize = this._count + minBytes;

            if (this._buffer.Length < requiredSize)
            {
                pool.EnlargeBuffer(ref this._buffer, requiredSize);
            }
        }
示例#2
0
 public ArraySegment <byte> GetFreeBuffer(int minBytes)
 {
     if (this._buffer == null)
     {
         this._buffer = pool.RentBuffer(minBytes);
     }
     else if (this._buffer.Length < minBytes)
     {
         pool.EnlargeBuffer(ref this._buffer, minBytes);
     }
     return(new ArraySegment <byte>(this._buffer));
 }
 void IFormatter.ResizeBuffer()
 {
     _pool.EnlargeBuffer(ref _buffer, _buffer.Length * 2);
 }