private static String readStreamIntoString ( Reader reader ) throws IOException { StringBuilder s = new StringBuilder ( ) ; char a [ ] = new char [ 0x10000 ] ; while ( true ) { int l = reader . read ( a ) ; if ( l == - 1 ) break ; if ( l <= 0 ) throw new IOException ( ) ; s . append ( a , 0 , l ) ; } return s . toString ( ) ; }
Reads the contents of a stream into a string variable .