Ejemplo n.º 1
0
 public void Recycle()
 {
     BytesPool.Recycle(m_buffer);
     m_bitsPointer = 0;
     m_buffer      = null;
     Pool.Recycle(this);
 }
Ejemplo n.º 2
0
        private void EnsureBufferSpace(int additionalSpaceInBits)
        {
            var length = m_buffer.Length;

            if (m_bitsPointer + additionalSpaceInBits > length << 3)
            {
                var tmpBuffer = m_buffer;
                var newBuffer = BytesPool.Get((int)(length * GrowingFactor) + 1);
                System.Buffer.BlockCopy(tmpBuffer, 0, newBuffer, 0, tmpBuffer.Length);
                BytesPool.Recycle(m_buffer);
                m_buffer = newBuffer;
            }
        }