Here you can find the source of readAll(Reader reader)
public static String readAll(Reader reader) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; public class Main { public static String readAll(Reader reader) throws IOException { BufferedReader bufferedReader = new BufferedReader(reader); StringBuilder builder = new StringBuilder(); String line;/*from w ww . ja v a2s . c o m*/ while ((line = bufferedReader.readLine()) != null) { builder.append(line).append("\n"); } bufferedReader.close(); return builder.toString(); } }