Detect how many bytes can be written to NSOutputStream
<h2>Basic problem I'm try to implement:</h2>

<p>I have two streams. <code>NSInputStream</code> and <code>NSOutputStream</code>.
Now I want to take some data from input process them (add some frames encode them and so on) and pass to output. So far so good.</p>

<h2>Actual problem</h2>

<p>Problem is that <code>NSOutputStream</code> API <code>- write:maxLength:</code> which can return actual number of bytes written. This value can be different from length passed. This is a problem since it requires creating extra logic to maintain some kind of buffer.
I want to avoid this. I'd like to now how many bytes output stream will accept without buffering so I could calculate how much data I should read from input stream (I will add some frames and encoding).
I don't want to maintain extra buffer.</p>

<p>Output stream is associated with a TCP socket, input stream can be associated with any kind of resource.</p>