private void ExpandBuffer(int appendingCount)
        {
            var oldBuffer = _buffer;

            _buffer = _arrayPool.Rent(Math.Max(_buffer.Length * 2, _buffer.Length + appendingCount));
            Buffer.BlockCopy(oldBuffer, 0, _buffer, 0, _writeIndex);
            _arrayPool.Return(oldBuffer);
        }
Пример #2
0
 // Token: 0x060006E2 RID: 1762 RVA: 0x000076BA File Offset: 0x000058BA
 public static char[] smethod_0(IArrayPool <char> iarrayPool_0, int int_0)
 {
     if (iarrayPool_0 == null)
     {
         return(new char[int_0]);
     }
     return(iarrayPool_0.Rent(int_0));
 }
Пример #3
0
 public static char[] RentBuffer([Nullable(2)] IArrayPool <char> bufferPool, int minSize)
 {
     if (bufferPool == null)
     {
         return(new char[minSize]);
     }
     return(bufferPool.Rent(minSize));
 }
Пример #4
0
        public static char[] RentBuffer(IArrayPool<char> bufferPool, int minSize) {
            if (bufferPool == null) {
                return new char[minSize];
            }

            char[] buffer = bufferPool.Rent(minSize);
            return buffer;
        }
Пример #5
0
        public static char[] RentBuffer(IArrayPool <char>?bufferPool, int minSize)
        {
            if (bufferPool == null)
            {
                return(new char[minSize]);
            }

            char[] buffer = bufferPool.Rent(minSize);
            return(buffer);
        }
Пример #6
0
        public static char[] EnsureBufferSize(IArrayPool<char> bufferPool, int size, char[] buffer) {
            if (bufferPool == null) {
                return new char[size];
            }

            if (buffer != null) {
                bufferPool.Return(buffer);
            }

            return bufferPool.Rent(size);
        }
Пример #7
0
 public static char[] EnsureBufferSize(IArrayPool <char> bufferPool, int size, char[] buffer)
 {
     if (bufferPool == null)
     {
         return(new char[size]);
     }
     if (buffer != null)
     {
         bufferPool.Return(buffer);
     }
     return(bufferPool.Rent(size));
 }
Пример #8
0
 // Token: 0x060006E4 RID: 1764 RVA: 0x000076D9 File Offset: 0x000058D9
 public static char[] smethod_2(IArrayPool <char> iarrayPool_0, int int_0, object object_0)
 {
     if (iarrayPool_0 == null)
     {
         return(new char[int_0]);
     }
     if (object_0 != null)
     {
         iarrayPool_0.Return(object_0);
     }
     return(iarrayPool_0.Rent(int_0));
 }
 public PooledMemoryStream(IArrayPool arrayPool, int baseLength)
 {
     _arrayPool  = arrayPool;
     _writeIndex = 0;
     _buffer     = arrayPool.Rent(baseLength);
 }
Пример #10
0
 public static char[] RentBuffer(IArrayPool <char> bufferPool, int minSize) =>
 bufferPool?.Rent(minSize);
Пример #11
0
 public static char[] RentBuffer(IArrayPool <char> bufferPool, int minSize)
 {
     return(bufferPool == null ? new char[minSize] : bufferPool.Rent(minSize));
 }