code: public static File download(String url, File toDir) throws AlipayApiException {
  		toDir.mkdirs();
  		HttpURLConnection conn = null;
  		OutputStream output = null;
  		File file = null;
  		try {
  			conn = getConnection(new URL(url));
  			String ctype = conn.getContentType();
  			if (CTYPE_OCTET.equals(ctype)) {
  				String fileName = getFileName(conn);
  				file = new File(toDir, fileName);
  				output = new FileOutputStream(file);
  				copy(conn.getInputStream(), output);
  			} else {
  				String rsp = WebUtils.getResponseAsString(conn);
                  throw new AlipayApiException(rsp);
  			}
  		} catch (IOException e) {
              throw new AlipayApiException(e.getMessage());
  		} finally {
  			closeQuietly(output);
  			if (conn != null) {
  				conn.disconnect();
  			}
  		}
  		return file;
  	}
docs: 通过HTTP GET方式下载文件到指定的目录。
  
  @param url 需要下载的URL
  @param toDir 需要下载到的目录
  @return 下载后的文件