bp74 / Zstandard.Net

A Zstandard wrapper for .Net
Other
135 stars 26 forks source link

Stream restart #5

Open vpenades opened 5 years ago

vpenades commented 5 years ago

I am aware that, in general compressed streams streams don't have position seek support... but nothing prevents adding extra methods.

Could it be possible to add a "Restart/Rewind/Rest" method that sets the position back to zero?

My intention is to read the compressed data of the file in a loop, so when I reach the end of the file, I jump back to the beginning.

bp74 commented 5 years ago

hi, you probably write the compressed data to MemoryStream right? You can set the position in the MemoryStream and read all the compressed data. Is this what you want to do?

vpenades commented 5 years ago

I write to a file, several gigabits on a few seconds. As you said, I could restart the underlying stream and see what happens.

As a side note, zstandard streams could expose a basestream property