Example #1
0
  public void display(URL url) {
    try {
      URLConnection urlc = url.openConnection();
      String contentType = urlc.getHeaderField("Content-Type");
      byte[] ba = IOUtil.toByteArray(urlc.getInputStream());

      display(new String(ba, determinCharset(contentType, "utf-8")));
    } catch (Exception e) {
      throw new RuntimeException("Error when accessing URL: " + url, e);
    }
  }