Java tutorial
//package com.java2s; import java.io.IOException; import java.io.Reader; public class Main { public static String readerToString(Reader reader) throws IOException { StringBuilder builder = new StringBuilder(); int bufferSize = 4096; char[] buf = new char[bufferSize]; int readed; while ((readed = reader.read(buf)) > 0) { builder.append(buf, 0, readed); } return builder.toString(); } }