用HttpURLConnection代替
1
2
3
4
5
6
7
8
9
|
URL url =
new
URL(
"http://www.android.com/"
);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try
{
InputStream in =
new
BufferedInputStream(urlConnection.getInputStream());
readStream(in);
finally
{
urlConnection.disconnect();
}
}
|