PageRenderTime 14ms CodeModel.GetById 10ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/UniversalImageLoader/src/com/nostra13/universalimageloader/core/download/HttpClientImageDownloader.java

https://github.com/rashedulkabir/Android-Universal-Image-Loader
Java | 29 lines | 23 code | 6 blank | 0 comment | 0 complexity | 559f4256b08602b45587d46dcdd21524 MD5 | raw file
 1package com.nostra13.universalimageloader.core.download;
 2
 3import java.io.IOException;
 4import java.io.InputStream;
 5import java.net.URI;
 6
 7import org.apache.http.HttpEntity;
 8import org.apache.http.HttpResponse;
 9import org.apache.http.client.HttpClient;
10import org.apache.http.client.methods.HttpGet;
11import org.apache.http.entity.BufferedHttpEntity;
12
13public class HttpClientImageDownloader extends ImageDownloader {
14
15	private HttpClient httpClient;
16
17	public HttpClientImageDownloader(HttpClient httpClient) {
18		this.httpClient = httpClient;
19	}
20
21	@Override
22	protected InputStream getStreamFromNetwork(URI imageUri) throws IOException {
23		HttpGet httpRequest = new HttpGet(imageUri.toString());
24		HttpResponse response = httpClient.execute(httpRequest);
25		HttpEntity entity = response.getEntity();
26		BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);
27		return bufHttpEntity.getContent();
28	}
29}