Here you can find the source of readAll(Reader reader)
public static String readAll(Reader reader) throws IOException
//package com.java2s; /* $This file is distributed under the terms of the license in /doc/license.txt$ */ import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; public class Main { /**// w w w .j a va2 s .c o m * Suck all the data from a {@link Reader} into a {@link String}. */ public static String readAll(Reader reader) throws IOException { StringBuilder result = new StringBuilder(); BufferedReader buffered = new BufferedReader(reader); char[] chunk = new char[4096]; int howMany; try { while (-1 != (howMany = buffered.read(chunk))) { result.append(chunk, 0, howMany); } } finally { reader.close(); } return result.toString(); } }