I have an istream object which is not seekable, ie. if I call seekg()
on it, then it will fail (the data comes from a decompressor which does not allow to backward seek in the compressed data). Is it possible to add a wrapper stream around the unseekable istream which adds limited seekability? For example which will always keep the last 8192 bytes that were read in memory so that one can seek at least that far back in the stream? If it is possible, then how?
I looked at a couple of tutorials about how to add streambuf::seekoff()
and streambuf::seekpos()
which I think are the functions I need for this but I cannot make heads or tails from the documentation.
Could somebody give me some pointers?
In other words: this question is for C++ what this question is for C#.