基于Java实现批量下载网络图片

基于Java实现批量下载网络图片

ID:40638782

大小:659.03 KB

页数:11页

时间:2019-08-05

基于Java实现批量下载网络图片_第1页
基于Java实现批量下载网络图片_第2页
基于Java实现批量下载网络图片_第3页
基于Java实现批量下载网络图片_第4页
基于Java实现批量下载网络图片_第5页
资源描述:

《基于Java实现批量下载网络图片》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、基于Java实现批量下载网络图片昨天朋友做项目遇到一个需求,需要把上千个的微博表情图片下载到本地磁盘,并做好规范命名,塞给我一堆Json数据,让我帮忙处理下,反正闲着也没事干,就帮忙写了。(很简单的一个功能,随手记录下,刚好填补下最近博客的空白)由于只是方便自己的工具,就不需要什么图形界面了,就用Java去写了,先看下效果图~嘿嘿,突然发现会写程序是件好事,一千多张表情图片要是手动下载再进行改名,非得忙个2天2夜不可。。好了,言归正传,说下代码实现,分成3步:1、获取Json数据2、根据Json数据所提供的图片资源地址进行下载3、分类,规范命名 先来看下Json数据格式:为

2、了方便操作,我封装了一个数据实体类1.package com.lcw.downloadutil.domain; 2. 3.public class Bean { 4. 5.    private String phrase; 6.    private String type; 7.    private String url; 8.    private Boolean hot; 9.    private Boolean common; 10.    private String category; 11.    private String icon; 12.    

3、private String value; 13.    private String picid; 14. 15.    public String getPhrase() { 16.        return phrase; 17.    } 18. 19.    public void setPhrase(String phrase) { 20.        this.phrase = phrase; 21.    } 22. 23.    public String getType() { 24.        return type; 25.    } 26.

4、 1.    public void setType(String type) { 2.        this.type = type; 3.    } 4. 5.    public String getUrl() { 6.        return url; 7.    } 8. 9.    public void setUrl(String url) { 10.        this.url = url; 11.    } 12. 13.    public Boolean getHot() { 14.        return hot; 15.    } 1

5、6. 17.    public void setHot(Boolean hot) { 18.        this.hot = hot; 19.    } 20. 21.    public Boolean getCommon() { 22.        return common; 23.    } 24. 25.    public void setCommon(Boolean common) { 26.        this.common = common; 27.    } 28. 29.    public String getCategory() { 3

6、0.        return category; 31.    } 32. 33.    public void setCategory(String category) { 34.        this.category = category; 35.    } 36. 37.    public String getIcon() { 38.        return icon; 39.    } 40. 41.    public void setIcon(String icon) { 42.        this.icon = icon; 43.    } 

7、44. 1.    public String getValue() { 2.        return value; 3.    } 4. 5.    public void setValue(String value) { 6.        this.value = value; 7.    } 8. 9.    public String getPicid() { 10.        return picid; 11.    } 12. 13.    public void setPicid(Strin

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。