public static int fetchUrl(URL url)
    throws IOException {
    URLConnection cnx = url.openConnection();
    InputStream in = cnx.getInputStream();

    byte[] buf = new byte[8192];
    int total = 0;
    int len = 0;
    while ((len = in.read(buf)) >= 0)
      total += len;

    return total;
  }
GET the given url.  Returns the number of bytes received.
hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/tool/TempletonUtils.java