/**
* 下载图片
*
* @param imageUrl
* 图片的地址
* @param client
* 访问HTTPS的client
* @return 返回是否已经下载完成
*/
public boolean saveImage(String imageUrl, DefaultHttpClient client) {
boolean finish = false;
if (imageUrl != null) {
HttpGet imageGet = new HttpGet(imageUrl);
try {
HttpResponse execute = client.execute(imageGet);
HttpEntity entity = execute.getEntity();
InputStream content = entity.getContent();
OutputStream outputStream = new FileOutputStream("C:\\Users\\admin\\Desktop\\IMG\\imgage.jpg");
IOUtils.copy(content, outputStream);
IOUtils.closeQuietly(content);
IOUtils.closeQuietly(outputStream);
finish = true;
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
System.out.println("下载验证码图片是否完成:" + finish);
return finish;
}