text: public void SetBufferSize(int newSize){Debug.Assert(m_buffer == null || bufferSize == m_buffer.Length, "buffer=" + m_buffer + " bufferSize=" + bufferSize + " buffer.length=" + (m_buffer != null ? m_buffer.Length : 0));if (newSize != bufferSize){CheckBufferSize(newSize);bufferSize = newSize;if (m_buffer != null){byte[] newBuffer = new byte[newSize];int leftInBuffer = bufferLength - bufferPosition;int numToCopy;if (leftInBuffer > newSize){numToCopy = newSize;}else{numToCopy = leftInBuffer;}Array.Copy(m_buffer, bufferPosition, newBuffer, 0, numToCopy);bufferStart += bufferPosition;bufferPosition = 0;bufferLength = numToCopy;NewBuffer(newBuffer);}}}