code: public R download(OutputStream out) throws DbxException,  IOException {
          try {
              IOUtil.copyStreamToStream(getInputStream(), out);
          } catch (IOUtil.WriteException ex) {
              // write exceptions should be IOException
              throw ex.getCause();
          } catch (IOException ex) {
              // everything else is a Network I/O problem
              throw new NetworkIOException(ex);
          } finally {
              close();
          }
  
          return result;
      }
docs: Downloads the response body to the given {@link OutputStream} and returns the server
  response.
  
  This method manages closing this downloader's resources, so no further calls to {@link
  #close} are necessary. The underlying {@code InputStream} returned by {@link #getInputStream}
  will be closed by this method.
  
  This method is the equivalent of
  
  <pre><code>
  try {
  InputStream in = downloader.getInputStream();
  // read from in, write to out
  return downloader.getResult();
  } finally {
  downloader.close();
  }
  </code></pre>
  
  @param out {@code OutputStream} to write response body to
  
  @return Response from server
  
  @throws DbxException if an error occurs reading the response or response body
  @throws IOException if an error occurs writing the response body to the output stream.
  @throws IllegalStateException if this downloader has already been closed (see {@link #close})