In particular I am using a Ionic.Zlib.ZlibStream to do Zlib compression on a System.Net.Sockets.NetworkStream.
Problem is, ZlibStream is a one-way stream; you can Read() or Write() but not both. You need two separate streams, one for sending and one for receiving (one compressing and the other decompressing). Which works fine until you need to pass it to functions that are expecting a single two-way stream (both Read() and Write() functionality). For example, new System.Net.Security.SslStream(Stream base).
I realize I can write a Stream class that takes a writing-stream and a reading-stream and calls the correct stream in the overrides. But I was hoping this already exists in the framework somewhere or there was an implementation already available.
I’m pretty sure there is no class that will do this for you. However, the wrapper class you’ll need to write is simple and shouldn’t take you very long at all.
You will probably inherit from Stream, but if you analyze your needs and the other available stream types, you may find that inheriting from a more specific class will help you out.
Edit: Due to Lucas B’s comments.
Please keep in mind that normal uses of Stream objects require that they actually inherit from Stream. Otherwise, you can’t pass it as a parameter to a large number functions that expect a stream.