private List<Quote> downloadUrl(String urlParam) throws IOException, XmlPullParserException {
  InputStream is=null;
  try {
    URL url=new URL(urlParam);
    HttpURLConnection conn=(HttpURLConnection)url.openConnection();
    conn.setReadTimeout(10000);
    conn.setConnectTimeout(15000);
    conn.setRequestMethod("GET");
    conn.setDoInput(true);
    conn.connect();
    int response=conn.getResponseCode();
    Log.d("Quotes_Generator","The response is: " + response);
    if (response == 200) {
      is=conn.getInputStream();
      return readXML(is);
    }
  }
  finally {
    if (is != null) {
      is.close();
    }
  }
  return null;
}

private List < Quote > downloadUrl ( String urlParam ) throws IOException , XmlPullParserException { InputStream is = null ; try { URL url = new URL ( urlParam ) ; HttpURLConnection conn = ( HttpURLConnection ) url . openConnection ( ) ; conn . setReadTimeout ( 10000 ) ; conn . setConnectTimeout ( 15000 ) ; conn . setRequestMethod ( "GET" ) ; conn . setDoInput ( true ) ; conn . connect ( ) ; int response = conn . getResponseCode ( ) ; Log . d ( "Quotes_Generator" , "The response is: " + response ) ; if ( response == 200 ) { is = conn . getInputStream ( ) ; return readXML ( is ) ; } } finally { if ( is != null ) { is . close ( ) ; } } return null ; }
given a url , establishes an httpurlconnection and retrieves the web page content as a inputstream , which it returns as a string .
