Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; public class Main { private static String read(InputStream is) throws IOException { StringBuilder sb = new StringBuilder(); BufferedReader bf = new BufferedReader(new InputStreamReader(is), 1000); String str = null; while ((str = bf.readLine()) != null) { sb.append(str); } bf.close(); bf = null; return sb.toString(); } }