Here you can find the source of bufferToString(BufferedReader br)
private static String bufferToString(BufferedReader br) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; public class Main { private static String bufferToString(BufferedReader br) throws Exception { StringBuffer sb = new StringBuffer(); try {// ww w.j a v a2 s. c o m for (String s = null; (s = br.readLine()) != null;) sb.append(s + "\n"); } catch (Exception e) { throw new Exception("Error reading the buffer: " + e.getMessage()); } return sb.toString(); } }