private String convertToString ( Reader reader ) throws IOException { StringBuilder stringBuilder = new StringBuilder ( ) ; int numChars ; char [ ] chars = new char [ 50 ] ; do { numChars = reader . read ( chars , 0 , chars . length ) ; if ( numChars > 0 ) { stringBuilder . append ( chars , 0 , numChars ) ; } } while ( numChars != - 1 ) ; return stringBuilder . toString ( ) ; }
Constructs a String by reading the characters from the Reader