public static String readURLConnection(URLConnection uc) throws Exception {
  StringBuffer buffer=new StringBuffer();
  BufferedReader reader=null;
  try {
    reader=new BufferedReader(new InputStreamReader(uc.getInputStream()));
    int letter=0;
    while ((letter=reader.read()) != -1) {
      buffer.append((char)letter);
    }
    reader.close();
  }
 catch (  Exception e) {
    BaseServlet.log(UPS2Servlet.class,"Could not read from URL: " + e.toString());
    throw e;
  }
 finally {
    if (reader != null) {
      reader.close();
      reader=null;
    }
  }
  return buffer.toString();
}

public static String readURLConnection ( URLConnection uc ) throws Exception { StringBuffer buffer = new StringBuffer ( ) ; BufferedReader reader = null ; try { reader = new BufferedReader ( new InputStreamReader ( uc . getInputStream ( ) ) ) ; int letter = 0 ; while ( ( letter = reader . read ( ) ) != - 1 ) { buffer . append ( ( char ) letter ) ; } reader . close ( ) ; } catch ( Exception e ) { BaseServlet . log ( UPS2Servlet . class , "Could not read from URL: " + e . toString ( ) ) ; throw e ; } finally { if ( reader != null ) { reader . close ( ) ; reader = null ; } } return buffer . toString ( ) ; }
this method read all of the data from a url connection to a string
