예제 #1
0
        /// <summary>Ends an asynchronous write operation.</summary>
        /// <param name="asyncResult">A reference to the outstanding asynchronous I/O request.</param>
        /// <exception cref="T:System.ArgumentNullException">
        ///   <paramref name="asyncResult" /> is null.</exception>
        /// <exception cref="T:System.ArgumentException">
        ///   <paramref name="asyncResult" /> did not originate from a <see cref="M:System.IO.Compression.DeflateStream.BeginWrite(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" /> method on the current stream.</exception>
        /// <exception cref="T:System.Exception">An exception was thrown during a call to <see cref="M:System.Threading.WaitHandle.WaitOne" />.</exception>
        /// <exception cref="T:System.InvalidOperationException">The stream is null.</exception>
        /// <exception cref="T:System.InvalidOperationException">The end write call is invalid.</exception>
        public override void EndWrite(IAsyncResult async_result)
        {
            if (async_result == null)
            {
                throw new ArgumentNullException("async_result");
            }
            AsyncResult asyncResult = async_result as AsyncResult;

            if (asyncResult == null)
            {
                throw new ArgumentException("Invalid IAsyncResult", "async_result");
            }
            WriteMethod writeMethod = asyncResult.AsyncDelegate as WriteMethod;

            if (writeMethod == null)
            {
                throw new ArgumentException("Invalid IAsyncResult", "async_result");
            }
            writeMethod.EndInvoke(async_result);
        }
예제 #2
0
        public override void EndWrite(IAsyncResult asyncResult)
        {
            if (asyncResult == null)
            {
                throw new ArgumentNullException("asyncResult");
            }

            AsyncResult ares = asyncResult as AsyncResult;

            if (ares == null)
            {
                throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
            }

            WriteMethod w = ares.AsyncDelegate as WriteMethod;

            if (w == null)
            {
                throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
            }

            w.EndInvoke(asyncResult);
            return;
        }