Skip to content

Instantly share code, notes, and snippets.

@jberkel
Created October 14, 2010 15:10
Show Gist options
  • Select an option

  • Save jberkel/626331 to your computer and use it in GitHub Desktop.

Select an option

Save jberkel/626331 to your computer and use it in GitHub Desktop.
private String getResponse(HttpURLConnection conn){
InputStream is = null;
try
{
is = conn.getInputStream();
int ch;
StringBuffer sb = new StringBuffer();
while( ( ch = is.read() ) != -1 ) {
sb.append( (char)ch );
}
return sb.toString();
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
try {
if (is != null)
is.close();
} catch (Exception e) {}
return "";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment