private static String readAll(InputStreamReader reader,int blockSize) throws IOException {
  final char buffer[]=new char[blockSize];
  StringBuilder builder=new StringBuilder();
  while (true) {
    final int readSize=reader.read(buffer);
    if (readSize >= 0)     builder.append(buffer,0,readSize);
 else     break;
  }
  return builder.toString();
}

private static String readAll ( InputStreamReader reader , int blockSize ) throws IOException { final char buffer [ ] = new char [ blockSize ] ; StringBuilder builder = new StringBuilder ( ) ; while ( true ) { final int readSize = reader . read ( buffer ) ; if ( readSize >= 0 ) builder . append ( buffer , 0 , readSize ) ; else break ; } return builder . toString ( ) ; }
reads from ' reader ' by ' blocksize ' until end - of - stream , and returns its complete contents .
