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 getString(InputStream inputStream) { BufferedReader bufferedReader; StringBuffer strBuffer = new StringBuffer(); try { bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); String line = null; while ((line = bufferedReader.readLine()) != null) { strBuffer.append(line); strBuffer.append("\n"); } bufferedReader.close(); } catch (IOException e) { e.printStackTrace(); } return strBuffer.toString(); } }