public void Write(byte[] buffer, int offset, int count)
{
int i = _position + count;
if (i > _length)
{
if (i > _capacity)
{
EnsureCapacity(i);
}
_length = i;
}
if ((count <= 8) && (buffer != _buffer))
{
int byteCount = count;
while (--byteCount >= 0)
_buffer[_position + byteCount] = buffer[offset + byteCount];
}
else
{
Std.BlockCopy(buffer, offset, _buffer, _position, Math.Min(count, buffer.Length - offset));
}
_position = i;
}