Here you can find the source of readResponse(HttpURLConnection conn, String encoding)
private static String readResponse(HttpURLConnection conn, String encoding)
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; public class Main { private static String readResponse(HttpURLConnection conn, String encoding) {//from ww w .j a v a 2 s .com StringBuffer sb = new StringBuffer(); BufferedReader br = null; try { InputStream in = conn.getInputStream(); br = new BufferedReader(new InputStreamReader(in)); String line = ""; while ((line = br.readLine()) != null) { sb.append(line); } in.close(); br.close(); conn.disconnect(); return new String(sb.toString()); } catch (IOException e) { e.printStackTrace(); return null; } } }