Java tutorial
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String readStringFromInputStream(InputStream is) throws IOException { BufferedReader rd = new BufferedReader(new InputStreamReader(is)); StringBuilder body = new StringBuilder(); String line; while ((line = rd.readLine()) != null) { body.append(line); } return body.toString(); } }