开发者社区> 问答> 正文

OSS 对象没有下载完,流读取的时候字返回可用字节为0

var getObjectRequest = new GetObjectRequest(bucketName, key);
                getObjectRequest.StreamTransferProgress += DownStreamProgressCallback;
                OssObject ossObject = client.GetObject(getObjectRequest);
                //设置下载超时时间
                ossObject.ResponseStream.ReadTimeout = 20*60*1000;
                using (var stream = ossObject.Content)
                {
                    var buffer = new byte[1024 * 1024];
                    using (var fs = new System.IO.MemoryStream())
                    {
                        var bytesRead = 0;
                        while (( bytesRead = stream.Read(buffer, 0, buffer.Length)) > 0)
                        {
                            // Process read data
                            // TODO
                            fs.Write(buffer, 0, bytesRead);
                        }


对象没有下载完,流读取的时候为什么返回0,一步提示异常

展开
收起
游客4ktz2qse7mtlm 2019-04-04 17:37:07 2618 0
4 条回答
写回答
取消 提交回答
问答排行榜
最热
最新

相关电子书

更多
OSS运维进阶实战手册 立即下载
《OSS运维基础实战手册》 立即下载
OSS运维基础实战手册 立即下载