code: public void download(final String uri, final File destFile) throws IOException {
          final String path = getPath(uri);
          final HttpGet request = (HttpGet) setupRequest(path, HttpGet.METHOD_NAME, Collections.<String, Object>emptyMap());
          HttpResponse response;
          OutputStream outputStream = null;
          try {
              response = httpClient.execute(request);
              final HttpEntity entity = response.getEntity();
  
              final StatusLine status = response.getStatusLine();
              final int statusCode = status.getStatusCode();
              if (statusCode >= 400) {
                  throw new IOException(EntityUtils.toString(entity));
              }
              outputStream = new BufferedOutputStream(new FileOutputStream(destFile));
              entity.writeTo(outputStream);
          } catch (final ClientProtocolException e1) {
              throw new IOException(e1);
          } catch (final IOException e1) {
              throw new IOException(e1);
          } finally {
              try {
                  if (outputStream != null) {
                      outputStream.close();
                  }
              } catch (final IOException ignore) {
                  
              }
          }
      }
docs: Convenience method to download files from the server. Used to retrieve media files.
  
  @param uri the URI.
  @param destFile the destination file.
  @throws IOException unexpected exception.