code: public static String readAsString(final URL url, final String encoding, final int bufSize) {
          try (final Reader reader = new InputStreamReader(url.openStream(), encoding)) {
              final StringBuilder sb = new StringBuilder();
              final char[] cbuf = new char[bufSize];
              int count;
              while ((count = reader.read(cbuf)) > -1) {
                  sb.append(String.valueOf(cbuf, 0, count));
              }
              return sb.toString();
          } catch (final IOException ex) {
              throw new RuntimeException(ex);
          }
      }
docs: Reads a given URL and returns the content as String.
  
  @param url
  URL to read.
  @param encoding
  Encoding (like 'utf-8').
  @param bufSize
  Size of the buffer to use.
  
  @return File content as String.