如何在Azure Blob流中启用搜索 [英] How to enable seeking in Azure Blob stream
问题描述
我有一个从方法OpenWriter创建的BlobStream.
I have a BlobStream that is created from the method OpenWriter.
var blob = CloudContainer.GetBlobReference(name));
if (blob == null)
{
return null;
}
return blob.OpenWrite();
使用此流,我想查找或设置位置,但是每次执行此操作时,我都会收到NotSupportedException.经过一些研究,我发现canSeek设置为false,这会导致此问题.但是,仅当长度未知时,CanSeek才为false.但是运行调试器时长度是已知的.
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.
为什么CanSeek是假的?我如何将其设置为true?
Why is CanSeek false? How can i make it set to true?
推荐答案
You can seek within a page blob - there is explicit support for it in BlobWriteStreamBase class.
我认为您也可以阅读&使用HTTP Range
标头写入Block Blob的指定部分,这实际上与查找相同.但是我认为您必须自己实现.
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.
这篇关于如何在Azure Blob流中启用搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!