Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { public static String inputStream2String(InputStream in) throws IOException { BufferedReader inReader = new BufferedReader(new InputStreamReader(in)); StringBuffer buffer = new StringBuffer(); String line = ""; while ((line = inReader.readLine()) != null) { buffer.append(line); } return buffer.toString(); } }