public static String slurpReader ( Reader reader ) { BufferedReader r = new BufferedReader ( reader ) ; StringBuilder buff = new StringBuilder ( ) ; try { char [ ] chars = new char [ SLURPBUFFSIZE ] ; while ( true ) { int amountRead = r . read ( chars , 0 , SLURPBUFFSIZE ) ; if ( amountRead < 0 ) { break ; } buff . append ( chars , 0 , amountRead ) ; } r . close ( ) ; } catch ( Exception e ) { throw new RuntimeIOException ( "slurpReader IO problem" , e ) ; } return buff . toString ( ) ; }
Returns all the text from the given Reader .