1.获取指定地址的输入流.URL url = new URL("url");InputStream in = url.openStream();2.在指定文件夹下创建文件。File dir = new File("指定文件夹");File file = new File(dir,"文件名");3.将下载保存到文件。FileOutputStream out = new FileOutputStream(file);Streams.copy(in, out, true);
1.获取指定地址的输入流.URL url = new URL("url");InputStream in = url.openStream();2.在指定文件夹下创建文件。File dir = new File("指定文件夹");File file = new File(dir,"文件名");3.将下载保存到文件。FileOutputStream out = new FileOutputStream(file);Streams.copy(in, out, true);