HttpClient client = new HttpClient(); GetMethod get = new GetMethod("http://images.sohu.com/uiue/sohu_logo/beijing2008/2008sohu.gif"); client.executeMethod(get); File storeFile = new File("c:/2008sohu.gif"); FileOutputStream output = new FileOutputStream(storeFile); //得到网络资源的字节数组,并写入文件 output.write(get.getResponseBody()); output.close();
GetMethod get = new GetMethod("http://images.sohu.com/uiue/sohu_logo/beijing2008/2008sohu.gif");
client.executeMethod(get);
File storeFile = new File("c:/2008sohu.gif");
FileOutputStream output = new FileOutputStream(storeFile);
//得到网络资源的字节数组,并写入文件
output.write(get.getResponseBody());
output.close();