Java tutorial
//package com.java2s; import java.io.BufferedReader; public class Main { public static String readerToString(BufferedReader reader) { StringBuffer rawBody = new StringBuffer(); String line = null; try { while ((line = reader.readLine()) != null) rawBody.append(line); } catch (Exception e) { /*report an error*/ } return rawBody.toString(); } }