VirtualStream, SeekableReadonlyStream and MarkableForwardOnlyEventingReadStream

来源:互联网 发布:淘宝消保金怎么交 编辑:程序博客网 时间:2024/06/13 22:53

This is interesting!

I am off projects for support these days, just bored and starting to poke Microsoft pipeline component framework for fun. It is interesting to discover that in Microsoft.BizTalk.Streaming namespace:

·         They have an implementation for VirtualStream! I am always using the SDK sample one but seems like this very implementation has more functions (and I believe is more stable) than the SDK free sample. I tried to compare the two and did find some differences, although the reflector generated code might not be accurate. I then opened the Microsoft SDK sample project (ArbitoryXPathHandler), remove the VirtualStream.cs and add reference of Microsoft.Streaming. I recompile the project and everything seems fine! I didn’t try to run the sample though, I just assume it works the same way.

·         They have a same implementation for ReadOnlySeekableStream as well.

·         They have another one, MarkableForwardOnlyEventingReadStream, as its name implies, you can MarkPosition and ResetPosition which helps a lot! By far, I didn’t find any special use of this stream but it seems more than just markable functions, as it is just everywhere within the default flatfile, xml pipeline implementations. And I also believe they are pretty stable and memory efficient as it is used in flat file disassembler.