title: Writing to stream is successful. But stream_get_contents() returns empty string
body: <p>I investigate opportunity to create my own microframework using PSR7 (don't ask my why!).So I created simple httpfoundation and templating components. Now I'm testing this part of my work and have next problem. 
  I create Response object: </p>
  
  <pre><code>public function __construct($statusCode = 200, $headers = null, $body = null)
      {
          $this-&gt;statusCode = $statusCode ? $statusCode : $this-&gt;checkedStatusCode($statusCode);
          $this-&gt;headers = $headers ? $headers : new Headers();
          $this-&gt;body = $body ? $body : new Stream(fopen('php://temp', 'w+'));
      }
  </code></pre>
  
  <p>The view is successfully generated. Then I try to write it in my Response object. 
  The code for this in my templating class </p>
  
  <pre><code>public function render(ResponseInterface $response, $template, array $data)
      {
          $output = $this-&gt;retrieve($template, $data);
          $response-&gt;getBody()-&gt;write($output);
          return $response;
      }
  </code></pre>
  
  <p>...and in Stream class</p>
  
  <pre><code>public function write($string)
      {
          if (!$this-&gt;isWritable()) {
              throw new \RuntimeException('Could not write to stream');
          }
  
          $result = fwrite($this-&gt;stream, $string);
          if ($result === false) {
              throw new \RuntimeException('Could not write to stream');
          }
  
          return $result;
      }
  </code></pre>
  
  <p>I think the result is successful because $result contains the number of bytes written!
  After that I try to retrive contents from my Response object with method dispatch() from Response class</p>
  
  <pre><code>public function dispatch()
      {
          return $this-&gt;getBody()-&gt;getContents();
      }
  </code></pre>
  
  <p>...and method getContents() from Stream class</p>
  
  <pre><code>public function getContents()
      {
          if (!$this-&gt;stream) {
              throw new \RuntimeException("Stream is not readable");
          }
  
          $result = stream_get_contents($this-&gt;stream);
          if ($result === false) {
              throw new \RuntimeException("Error reading of stream");
          }
  
          return $result;
      }
  </code></pre>
  
  <p>I get empty string!
  Please help me understand where I lose written body! And why I get empty string!
  Thank U!</p>