Here you can find the source of downloadJson(URI uri)
private static String downloadJson(URI uri)
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URI; import java.util.zip.GZIPInputStream; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import android.util.Log; public class Main { private static final String TAG = "SOHelper"; private static String downloadJson(URI uri) { try {//from w w w . j a va 2s . co m Log.i(TAG, "downloading user flair from " + uri); HttpClient httpClient = new DefaultHttpClient(); HttpGet httpGet = new HttpGet(uri); HttpResponse httpResponse = httpClient.execute(httpGet); BufferedReader reader = new BufferedReader( new InputStreamReader(new GZIPInputStream(httpResponse .getEntity().getContent())), 8 * 1024); StringBuffer response = new StringBuffer(); String line; while ((line = reader.readLine()) != null) { response.append(line); } reader.close(); return response.toString(); } catch (IOException ex) { Log.e(TAG, String.format("error downloading flair (%s)", uri)); return null; } } }