public static String readFully ( BufferedReader reader ) throws IOException { if ( reader == null ) { return null ; } StringBuilder sb = new StringBuilder ( BUFFER_SIZE ) ; char [ ] buf = new char [ BUFFER_SIZE ] ; try { int len ; // read until we reach then end which is the -1 marker while ( ( len = reader . read ( buf ) ) != - 1 ) { sb . append ( buf , 0 , len ) ; } } finally { IOHelper . close ( reader , "reader" , LOG ) ; } return sb . toString ( ) ; }
Reads the entire reader into memory as a String