/// <summary>Begins an asynchronous read operation.</summary> /// <returns>An <see cref="T:System.IAsyncResult" /> object that represents the asynchronous read, which could still be pending.</returns> /// <param name="array">The byte array to read the data into.</param> /// <param name="offset">The byte offset in <paramref name="array" /> at which to begin writing data read from the stream.</param> /// <param name="count">The maximum number of bytes to read.</param> /// <param name="asyncCallback">An optional asynchronous callback, to be called when the read is complete.</param> /// <param name="asyncState">A user-provided object that distinguishes this particular asynchronous read request from other requests.</param> /// <exception cref="T:System.IO.IOException">An asynchronous read past the end of the stream was attempted, or a disk error occurred.</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 <see cref="T:System.IO.Compression.DeflateStream" /> implementation does not support the read operation.</exception> /// <exception cref="T:System.InvalidOperationException">This call cannot be completed. </exception> public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback cback, object state) { if (disposed) { throw new ObjectDisposedException(GetType().FullName); } if (!CanRead) { throw new NotSupportedException("This stream does not support reading"); } if (buffer == null) { throw new ArgumentNullException("buffer"); } if (count < 0) { throw new ArgumentOutOfRangeException("count", "Must be >= 0"); } if (offset < 0) { throw new ArgumentOutOfRangeException("offset", "Must be >= 0"); } if (count + offset > buffer.Length) { throw new ArgumentException("Buffer too small. count/offset wrong."); } ReadMethod readMethod = ReadInternal; return(readMethod.BeginInvoke(buffer, offset, count, cback, state)); }
public override IAsyncResult BeginRead(byte [] array, int offset, int count, AsyncCallback asyncCallback, object asyncState) { if (disposed) { throw new ObjectDisposedException(GetType().FullName); } if (!CanRead) { throw new NotSupportedException("This stream does not support reading"); } if (array == null) { throw new ArgumentNullException("array"); } if (count < 0) { throw new ArgumentOutOfRangeException("count", "Must be >= 0"); } if (offset < 0) { throw new ArgumentOutOfRangeException("offset", "Must be >= 0"); } if (count + offset > array.Length) { throw new ArgumentException("Buffer too small. count/offset wrong."); } ReadMethod r = new ReadMethod(ReadInternal); return(r.BeginInvoke(array, offset, count, asyncCallback, asyncState)); }
public override IAsyncResult BeginRead (byte [] buffer, int offset, int count, AsyncCallback cback, object state) { if (disposed) throw new ObjectDisposedException (GetType ().FullName); if (!CanRead) throw new NotSupportedException ("This stream does not support reading"); if (buffer == null) throw new ArgumentNullException ("buffer"); if (count < 0) throw new ArgumentOutOfRangeException ("count", "Must be >= 0"); if (offset < 0) throw new ArgumentOutOfRangeException ("offset", "Must be >= 0"); if (count + offset > buffer.Length) throw new ArgumentException ("Buffer too small. count/offset wrong."); ReadMethod r = new ReadMethod (ReadInternal); return r.BeginInvoke (buffer, offset, count, cback, state); }