How to enable seeking in Azure Blob stream

做~自己de王妃 提交于 2019-12-13 06:26:15

问题


I have a BlobStream that is created from the method OpenWriter.

var blob = CloudContainer.GetBlobReference(name));
if (blob == null)
{
   return null;
}

return blob.OpenWrite();

Using this stream i would like to seek or set the position, but each time i do this i get a NotSupportedException. After doing some research i found that the canSeek is set to false, which causes this problem. But, the CanSeek is false only if the length is unknown. But the length is known when i run the debugger.

Why is CanSeek false? How can i make it set to true?


回答1:


You can seek within a page blob - there is explicit support for it in BlobWriteStreamBase class.

I think you could also read & write to specified parts of a Block blob using HTTP Range headers, which would be effectively the same thing as seeking. But I think you'd have to implement that yourself.



来源:https://stackoverflow.com/questions/16497241/how-to-enable-seeking-in-azure-blob-stream

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