阅读背景:

通过URL下载文件

来源:互联网 

做项目进程中,须要依据他人供给的URL去下载附件。

			// 树立衔接
			HttpClient client = new HttpClient();
			client.getHttpConnectionManager().getParams().setConnectionTimeout(5000);
			
			HttpMethod method = null;
			// 取得文件流
			method = new GetMethod(url);
			client.executeMethod(method);
			
			// 打印http交互信息
			printHttpInteractInfo(method);
			
		    // 获得文件流
		    InputStream inputStream = method.getResponseBodyAsStream();

			// 树立衔接
			HttpClien




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: