public override void Write(byte[] buffer, int offset, int count) { int nwritten; byte[] buf; if (stream == null) { throw new ObjectDisposedException("GMimeStream", "The backing stream has been closed."); } if (offset > buffer.Length) { throw new ArgumentOutOfRangeException("offset"); } if (offset + count > buffer.Length) { throw new ArgumentOutOfRangeException("count"); } if (offset != 0) { buf = new byte [count]; Array.Copy(buffer, offset, buf, 0, count); } else { buf = buffer; } nwritten = (int)stream.Write(buf, (uint)count); if (nwritten < 0) { throw new IOException(); } }