Exemplo n.º 1
0
 /// <summary>
 /// Begins an asynchronous write operation.
 /// </summary>
 /// <param name="buffer">The buffer to write data from.</param>
 /// <param name="offset">The byte offset in <paramref name="buffer"/> from which to begin writing.</param>
 /// <param name="count">The maximum number of bytes to write.</param>
 /// <param name="callback">An optional asynchronous callback, to be called when the write is complete.</param>
 /// <param name="state">A user-provided object that distinguishes this particular asynchronous write request from other requests.</param>
 /// <returns>
 /// An IAsyncResult that represents the asynchronous write, which could still be pending.
 /// </returns>
 /// <exception cref="T:System.IO.IOException">Attempted an asynchronous write past the end of the stream, or a disk error occurs. </exception>
 /// <exception cref="T:System.ArgumentException">One or more of the arguments is invalid. </exception>
 /// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
 /// <exception cref="T:System.NotSupportedException">The current Stream implementation does not support the write operation. </exception>
 public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
 {
     if (_proxyAsyncRequests)
     {
         return(BaseStream.BeginWrite(buffer, offset, count, callback, state));
     }
     else
     {
         return(base.BeginWrite(buffer, offset, count, callback, state));
     }
 }
Exemplo n.º 2
0
		private void DoWrite(byte[] array, int offset, int count, bool isAsync)
		{
			Debug.Assert(array != null);
			Debug.Assert(count != 0);

#if !NETFX_CORE
			if (isAsync)
			{
				var result = BaseStream.BeginWrite(array, offset, count, null, null);
				BaseStream.EndWrite(result);
			}
			else 
#endif
			{
				BaseStream.Write(array, offset, count);
			}
		}
Exemplo n.º 3
0
        /// <summary>异步开始写</summary>
        /// <param name="buffer">缓冲区</param>
        /// <param name="offset">偏移</param>
        /// <param name="count">数量</param>
        /// <param name="callback"></param>
        /// <param name="state"></param>
        /// <returns></returns>
        public override IAsyncResult BeginWrite(Byte[] buffer, Int32 offset, Int32 count, AsyncCallback callback, Object state)
        {
            RaiseAction("BeginWrite", offset, count);

            return(BaseStream.BeginWrite(buffer, offset, count, callback, state));
        }
Exemplo n.º 4
0
 public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
 {
     return(BaseStream.BeginWrite(buffer, offset, count, callback, state));
 }