url资源下载,有一个很实用的工具类FileUtils

1
2
3
4
5
6
7
try {
URL httpUrl = new URL("http://xxx");
File f = new File("存储路径+文件名+后缀");
FileUtils.copyURLToFile(httpUrl, f);
} catch (Exception e) {
e.printStackTrace();
}