code: public static void saveContentToFile(URL url, File file) throws IOException {
          InputStream is = url.openStream();
          FileOutputStream fos = new FileOutputStream(file);
          byte[] b = new byte[1024];
          int len;
          while ((len = is.read(b)) != -1) {
              fos.write(b, 0, len);
          }
          fos.flush();
          fos.close();
          is.close();
      }
docs: 保存网络文件到指定文件
  
  @param url  文件地址
  @param file 文件
  @throws IOException io exception