ReadOnlyStream.ReadAsync not working for Windows Phone 8.1

倾然丶 夕夏残阳落幕 提交于 2019-12-12 00:07:01

问题


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

来源:https://stackoverflow.com/questions/30776448/readonlystream-readasync-not-working-for-windows-phone-8-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!