public static byte[] urlTobyte(String url) throws MalformedURLException {
URL ur = new URL(url);
BufferedInputStream in = null;
ByteArrayOutputStream out = null;
try {
in = new BufferedInputStream(ur.openStream());
out = new ByteArrayOutputStream(1024);
byte[] temp = new byte[1024];
int size = 0;
while ((size = in.read(temp)) != -1) {
out.write(temp, 0, size);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
byte[] content = out.toByteArray();
return content;
}

最新文章

  1. javascript中的Array对象 —— 数组的合并、转换、迭代、排序、堆栈
  2. css实现省略号
  3. 【BZOJ-3667】Rabin_Miller算法 随机化判素数
  4. jad 反编译java
  5. CAF(C++ actor framework)使用随笔(send sync_send)(二)
  6. 在Linux系统中修改IP地址
  7. R语言学习笔记之外部文件读取
  8. C++ STL之min_element()与max_element()(取容器中的最大最小值)
  9. light oj 1152 Hiding Gold
  10. Linux下创建软链接
  11. C语言中extern关键字的使用
  12. Python包中__init__.py作用
  13. 【HP-UNIX】修改HP-UNIX主机名称
  14. C++ 继承与派生
  15. eclipse:报错信息The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
  16. Python3 函数注解
  17. CentOS6.7的安装
  18. pymysql的使用心得(1)------小细节,注意!
  19. 【线段树】HDU 3397 Sequence operation 区间合并
  20. Spring在xml配置里配置事务

热门文章

  1. 第十八章节 BJROBOT 安卓手机 APP 建地图【ROS全开源阿克曼转向智能网联无人驾驶车】
  2. Windows系统设置多用户同时远程登录
  3. react项目中实现搜索关键字呈现高亮状态(一)
  4. 直播预告 | 开源的云原生开发环境 —— Nocalhost
  5. JVM 源码分析(三):深入理解 CAS
  6. MongoDB Sharding(一) -- 分片的概念
  7. SQLI-LABS复现通关
  8. SDUST数据结构 - chap6 树与二叉树
  9. SAP中的密码输入框
  10. C++:I/O流的概念和流类库的结构