public override void Write(byte[] buffer, int offset, int count) { if (buffer == null) { throw new ArgumentNullException("buffer"); } if (offset + count > buffer.Length) { throw new ArgumentException("(offset + count) is greater than the length of buffer"); } if (offset < 0) { throw new ArgumentOutOfRangeException("offset"); } if (count < 0) { throw new ArgumentOutOfRangeException("count"); } if (!CanWrite) { throw new NotSupportedException("The stream does not support writing"); } if (is_disposed) { throw new ObjectDisposedException("The stream is closed"); } OutputStream output_stream = null; if (stream is OutputStream) { output_stream = stream as OutputStream; } #if GIO_SHARP_2_22 else if (stream is IOStream) { output_stream = (stream as IOStream).OutputStream; } #endif if (output_stream == null) { throw new System.Exception("this shouldn't happen"); } if (offset == 0) { output_stream.Write(buffer, (ulong)count, null); return; } else { byte[] buf = new byte[count]; Array.Copy(buffer, offset, buf, 0, count); output_stream.Write(buf, (ulong)count, null); return; } }