Here you can find the source of readAll(Reader rd)
private static String readAll(Reader rd) throws IOException
//package com.java2s; import java.io.*; public class Main { private static String readAll(Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); int cp;/*w ww . jav a 2s . com*/ while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.toString(); } }