xception;
public void writeToPNG (OutputStream stream) throws IOException;
</pre>
<p>
      In many cases, it will be better to
      implement the filename version internally
      using the stream version, rather than building it on top of the
      filename version in C. The reason for this is that will
      naturally give a more standard handling of file errors for
      the language, as seen in the above Java example, where
      <code class="methodname">createFromPNG()</code> is marked as raising
   