Here you can find the source of readAll(final Reader rd)
private static String readAll(final Reader rd) throws IOException
//package com.java2s; /*/*w ww . j a v a 2 s. c o m*/ * Copyright (c) 2010 INSciTE. All rights reserved * INSciTE is on the web at: http://www.hightechkids.org * This code is released under GPL; see LICENSE.txt for details. */ import java.io.IOException; import java.io.Reader; public class Main { private static String readAll(final Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.toString(); } }