public int Read([In, Out] byte[] array, int offset, int count) { int i; if (count <= (int)512) //DataBlockSize.Minimum) { i = RealStream.Read(array, offset, count); } else { IAsyncResult iar = RealStream.BeginRead(array, offset, count, null, null); if (!iar.IsCompleted) { iar.AsyncWaitHandle.WaitOne(); } i = RealStream.EndRead(iar); } InUse = false; return(i); }
public IAsyncResult BeginRead(byte[] array, int offset, int numBytes, AsyncCallback userCallback, object stateObject) { return(RealStream.BeginRead(array, offset, numBytes, userCallback, stateObject)); }