Here you can find the source of readAll(Reader in)
public static String readAll(Reader in) throws IOException
//package com.java2s; /* Copyright(c) 2013 M Hata This software is released under the MIT License. http://opensource.org/licenses/mit-license.php */ import java.io.IOException; import java.io.Reader; public class Main { public static String readAll(Reader in) throws IOException { StringBuilder sb = new StringBuilder(); while (true) { int c = in.read(); if (c < 0) { break; } else { sb.append((char) c); }/*w ww .j a v a 2 s .c o m*/ } return sb.toString(); } }