Here you can find the source of loadReader(Reader stream)
private static String loadReader(Reader stream) throws IOException
//package com.java2s; // it under the terms of the GNU General Public License as published by import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; public class Main { private static String loadReader(Reader stream) throws IOException { BufferedReader r = null;//from w w w . j a v a 2s . c o m StringBuilder text = new StringBuilder(); try { r = new BufferedReader(stream); String line = null; while ((line = r.readLine()) != null) { text.append(line); text.append(System.getProperty("line.separator")); } } finally { if (r != null) { r.close(); } } return text.toString(); } }