72340

How to enable seeking in Azure Blob stream

Question:

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?

Answer1:

You can seek within a page blob - there is explicit support for it in <a href="https://github.com/Azure/azure-storage-net/blob/master/Lib/Common/Blob/BlobWriteStreamBase.cs" rel="nofollow">BlobWriteStreamBase</a> 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.

Recommend

  • Create an empty stream from a string on which Stream.Read() waits when no data
  • log request json data
  • SQL Server varchar(50) and varchar(128) performance difference [duplicate]
  • how to play a mp3 file from the middle
  • Vector Drawables in Layer List on Android API 16 and higher
  • Matlab to Python Conversion binary file read
  • Unzip archive in .Net CORE 1.0
  • Streaming screenshots over WebRTC as a video stream from iOS
  • Blackberry - Custom EditField Cursor
  • Play WS (2.2.1): post/put large request
  • Bad request using file_get_contents for PUT request in PHP
  • Python CGI os.system causing malformed header
  • Body moving without any force applied? (Box2d)
  • Is there a javascript serializer for JSON.Net?
  • Jenkins: How To Build multiple projects from a TFS repository?
  • Nant, Vault & Windows Integrated Authentication
  • Regex thinks I'm nesting, but I'm not
  • Fetching methods from BroadcastReceiver to update UI
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Bug in WPF DataGrid
  • TFS: Get latest causes slow project reloading
  • Controls, properties, events and timers running in design time
  • Does CUDA 5 support STL or THRUST inside the device code?
  • Running a C# exe file
  • Join two tables and save into third-sql
  • How to model a transition system with SPIN
  • ORA-29908: missing primary invocation for ancillary operator
  • How to set the response of a form post action to a iframe source?
  • Change div Background jquery
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • Android Google Maps API OnLocationChanged only called once
  • Qt: Run a script BEFORE make
  • How can I remove ASP.NET Designer.cs files?
  • Bitwise OR returns boolean when one of operands is nil
  • Are Kotlin's Float, Int etc optimised to built-in types in the JVM? [duplicate]
  • sending mail using smtp is too slow
  • reshape alternating columns in less time and using less memory
  • costura.fody for a dll that references another dll
  • Binding checkboxes to object values in AngularJs
  • Converting MP3 duration time