C# chaining methods using streams
<p>I have two different objects in c# that expose methods using streams.</p>

<p>One of them exposes a method that takes a Stream as a parameter and writes to the stream, while the other exposes a method that takes a Stream as a parameter and reads from it.</p>

<p>Writing stuff to a MemoryStream is out of the question as there is too much data to keep completely in memory. Is there a way I can somehow chain these two methods, or do I have to manually write an adaptor of some kind to go in between myself?</p>

<p>Edit:</p>

<p>one of the methods looks like this, which serializes the object to a stream:</p>

<pre><code>object1.WriteToStream(Stream s)
</code></pre>

<p>while the other looks like this:</p>

<pre><code>object2.Process(Stream input, Stream output)
</code></pre>

<p>The second method reads from the input stream, processes the data and writes it to another stream. My problem is that I need to use the 2nd method to process the data generated by the <code>WriteToStream</code> method of the first object.</p>