Java tutorial
//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 { static String readAllOf(InputStream s) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(s), 8096); String line; StringBuilder log = new StringBuilder(); while ((line = bufferedReader.readLine()) != null) { log.append(line); log.append("\n"); } return log.toString(); } }