Here you can find the source of fromStream(InputStream inputStream)
public static String fromStream(InputStream inputStream) throws IOException
//License from project: Open Source License import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main{ private static final int BUFFER_SIZE = 4096; public static String fromStream(InputStream inputStream) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader( inputStream), BUFFER_SIZE); StringBuilder stringBuilder = new StringBuilder(); String line;//from w ww. j a v a2 s .c om try { while ((line = reader.readLine()) != null) { ALog.i(line); stringBuilder.append(line); } } finally { inputStream.close(); } return stringBuilder.toString(); } }