ReadOnlyStream.ReadAsync not working for Windows P

2019-09-02 00:21发布

I have a windows universal application catering to 8.1. I am using StreamContent.ReadAsync for reading data in chunks.

My code is something like this

 using (Stream input = session.GetContentStream(obj, null, bytesWritten, conentStreamLength-bytesWritten).Stream)
            using (cancellationToken.Register(() => input.Dispose()))
            {
                if (output.Length > 0)
                    output.Seek(output.Length, SeekOrigin.Begin);

                int length = (int)this.document.ContentLength;
                byte[] buffer = new byte[length];
                int read;

                while ((read = await input.ReadAsync(buffer, 0, length, cancellationToken)) > 0)
                {
                    await output.WriteAsync(buffer, 0, read);
                    bytesWritten += read;
                    FireStatusEvent(this.document, bytesWritten, TaskCurrentStatus.InProgress, jobInProgress.Priority);
                }
            }

Where the input instance is of type System.Net.Http.StreamContent.ReadOnlyStream

My tablet application is working but the windows phone 8.1

Any hints on this ?

Thanks and Regards, Saurav

0条回答
登录 后发表回答