code: public void writeToStream(OutputStream os)
      throws IOException
    {
      StreamImpl is = openReadImpl();
      TempBuffer tempBuffer = TempBuffer.create();
      try {
        byte []buffer = tempBuffer.buffer();
        int length = buffer.length;
        int len;
  
        while ((len = is.read(buffer, 0, length)) > 0) {
          os.write(buffer, 0, len);
        }
      } finally {
        TempBuffer.free(tempBuffer);
        tempBuffer = null;
  
        is.close();
      }
    }
docs: Utility to write the contents of this path to the destination stream.
  
  @param os destination stream.