java下载远程文件到本地
来源:互联网 发布:北京东华软件 编辑:程序博客网 时间:2024/05/29 02:58
参数说明:
httpUrl:下载文件的地址
saveFile:本地保存的地址
public static boolean httpDownload(String httpUrl, String saveFile) { // 下载网络文件 //int bytesum = 0; int byteread = 0; URL url = null; try { url = new URL(httpUrl); } catch (MalformedURLException e1) { e1.printStackTrace(); return false; } try { URLConnection conn = url.openConnection(); InputStream inStream = conn.getInputStream(); FileOutputStream fs = new FileOutputStream(saveFile); byte[] buffer = new byte[1024]; while ((byteread = inStream.read(buffer)) != -1) { //bytesum += byteread; //System.out.println(bytesum); fs.write(buffer, 0, byteread); } inStream.close(); fs.close(); return true; } catch (FileNotFoundException e) { e.printStackTrace(); return false; } catch (IOException e) { e.printStackTrace(); return false; } }
0 0
- java下载远程文件到本地
- java 远程从FTP服务器下载文件到本地
- java 下载远程电脑文件到本地电脑
- 工具类—Java下载远程文件到本地
- C# 下载远程http文件到本地
- PHP实现远程下载文件到本地
- HTTP网络远程下载文件到本地
- java 下载文件到本地
- java 下载文件到本地
- Java文件下载到本地
- java下载远程FTP文件至本地
- python urllib从远程服务器下载文件到本地
- 从远程服务器下载文件到本地服务器
- python urllib从远程服务器下载文件到本地
- PHP代码实现远程下载文件到本地
- Open SSH 登陆远程主机,怎样下载文件到本地?
- PHP代码实现远程下载文件到本地的函数
- 将远程的git文件下载到本地
- 简单写字板
- 数据库系统原理与设计~基本概念的接触(一)
- 项目文档的编写
- 怎样获取当前时间并输出今天是一年中的第几天,所在月份的第几天?
- 性能优化
- java下载远程文件到本地
- JS粗读笔记(乱七八糟一锅炖版二)
- 使用IntentService解决点我达骑手APP消息提醒机制中的优先级排序问题
- 判断一个数是否为水仙花数
- Linux下垃圾清理方法总结
- Java设计模式之——组合模式
- spring配置freemarker视图解析器
- 隐马尔可夫模型的forward算法的c实现
- Javascript事件总结