Java tutorial
//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 { 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(); } }