Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Write() [1/2]

override void System.IO.MemoryStream.Write ( byte[] buffer,
int offset,
int count )
inlineinherited

Definition at line 548 of file MemoryStream.cs.

549 {
550 Stream.ValidateBufferArguments(buffer, offset, count);
553 int num = _position + count;
554 if (num < 0)
555 {
556 throw new IOException(SR.IO_StreamTooLong);
557 }
558 if (num > _length)
559 {
560 bool flag = _position > _length;
561 if (num > _capacity && EnsureCapacity(num))
562 {
563 flag = false;
564 }
565 if (flag)
566 {
567 Array.Clear(_buffer, _length, num - _length);
568 }
569 _length = num;
570 }
571 if (count <= 8 && buffer != _buffer)
572 {
573 int num2 = count;
574 while (--num2 >= 0)
575 {
576 _buffer[_position + num2] = buffer[offset + num2];
577 }
578 }
579 else
580 {
581 Buffer.BlockCopy(buffer, offset, _buffer, _position, count);
582 }
583 _position = num;
584 }
bool EnsureCapacity(int value)

References System.IO.MemoryStream._buffer, System.IO.MemoryStream._capacity, System.IO.MemoryStream._length, System.IO.MemoryStream._position, System.Buffer.BlockCopy(), System.buffer, System.Array.Clear(), System.count, System.IO.MemoryStream.EnsureCapacity(), System.IO.MemoryStream.EnsureNotClosed(), System.IO.MemoryStream.EnsureWriteable(), System.SR.IO_StreamTooLong, System.offset, and System.IO.Stream.ValidateBufferArguments().

Referenced by System.Net.RequestStream.Write(), and System.Xml.XmlBinaryNodeWriter.AttributeValue.WriteBase64Text().