Here you can find the source of readAll(InputStreamReader reader)
public static String readAll(InputStreamReader reader) throws IOException
//package com.java2s; //License from project: LGPL import java.io.IOException; import java.io.InputStreamReader; public class Main { public static String readAll(InputStreamReader reader) throws IOException { char[] buffer = new char[1024]; StringBuilder contents = new StringBuilder(); int len = 0; while ((len = reader.read(buffer)) != -1) { contents.append(buffer, 0, len); }/* ww w . j a va 2 s . c o m*/ reader.close(); return contents.toString(); } }