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 getStringFromInputStream(InputStream is) { StringBuilder sb = new StringBuilder(); BufferedReader br = new BufferedReader(new InputStreamReader(is)); String line = null; try { while ((line = br.readLine()) != null) { sb.append(line); sb.append("\n"); } } catch (IOException e) { } finally { if (br != null) { try { br.close(); } catch (IOException e) { } } } return sb.toString(); } }