public static String getText ( Reader reader ) throws IOException { try { StringBuilder source = new StringBuilder ( ) ; BufferedReader buffered = new BufferedReader ( reader ) ; String line = buffered . readLine ( ) ; while ( line != null ) { source . append ( line ) ; source . append ( ' ' ) ; line = buffered . readLine ( ) ; } return source . toString ( ) ; } finally { closeQuietly ( reader ) ; } }
Returns the text read from the given reader as a String . Closes the given reader upon return .