// Flush the pending contents in this stream. public override void Flush() { lock (this) { if (handle != invalidHandle) { if (bufferOwnedByWrite) { FlushWriteBuffer(); if (!FileMethods.FlushWrite(handle)) { throw new IOException (FileMethods.GetErrno(), _("IO_FlushFailed")); } } else { FlushReadBuffer(); } } else { throw new ObjectDisposedException (_("IO_StreamClosed")); } } }