java从网站上下载图片的思路:
1.通过url类得到浏览器的输入的文件流
2.复制制定的文件
public static void download(String urlString, String filename,String savePath) throws Exception {
URL url = new URL(urlString);URLConnection con = url.openConnection();
InputStream is = con.getInputStream();
File sf = new File(savePath);
OutputStream os = new FileOutputStream(sf.getPath() + File.separator + "a.jpg");
int len = 0;
byte[] bs = new byte[1024];
while ((len = is.read(bs) )!= -1) {
os.write(bs,0,len);
}
is.close();
os.close();
}