Here you can find the source of readFile(InputStream stream, StringBuilder builder)
private static void readFile(InputStream stream, StringBuilder builder) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { private static void readFile(InputStream stream, StringBuilder builder) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(stream)); String s = ""; try {/*from ww w.j av a 2 s . c o m*/ while ((s = br.readLine()) != null) { builder.append(s + "\n"); } } catch (IOException e) { e.printStackTrace(); } finally { br.close(); stream.close(); } } }