Here you can find the source of readAll(InputStream inputStream)
public static String readAll(InputStream inputStream) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; public class Main { public static String readAll(InputStream inputStream) throws IOException { StringBuilder result = new StringBuilder(); BufferedInputStream buffered = new BufferedInputStream(inputStream); int i;/* www . ja v a 2 s . c o m*/ while ((i = buffered.read()) != -1) { result.append((char) i); } return result.toString(); } }