HttpURLConnection中connection.getInputStream()报异常FileNotFoundException


HttpURLConnection中connection.getInputStream()报异常FileNotFoundException,各位帮忙看看
代码如下:
String httpUrl = "http://192.168.1.102:8080/http/";


//获得的数据
String resultData = "";
URL url = null;
try
{
//构造一个URL对象
url = new URL(httpUrl);

}
catch (MalformedURLException e)
{
Log.e(DEBUG_TAG, "MalformedURLException");
}

if (url != null)
{
try {
//使用HttpURLConnection打开连接
HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
urlConn.connect();
//得到读取的内容(流)
InputStreamReader in = new InputStreamReader(urlConn.getInputStream());
// 为输出创建BufferedReader
BufferedReader buffer = new BufferedReader(in);
String inputLine = null;
//使用循环来读取获得的数据
while (((inputLine = buffer.readLine()) != null))
{
//我们在每一行后面加上一个"\n"来换行
resultData += inputLine + "\n";
}
//关闭InputStreamReader
in.close();
//关闭http连接
urlConn.disconnect();
//设置显示取得的内容
if (resultData != null)
{
m_TextView.setText(resultData);

}
else
{
m_TextView.setText("读取的内容为NULL");
}
}
catch (IOException e)
{
Log.e(DEBUG_TAG, "IOException");
}
}
else
{
Log.e(DEBUG_TAG, "Url NULL");
}


输出的提示信息如下:
10-12 10:25:38.264: I/Choreographer(1728): Skipped 67 frames!  The application may be doing too much work on its main thread.
10-12 10:25:39.244: I/Choreographer(1728): Skipped 86 frames!  The application may be doing too much work on its main thread.
10-12 10:25:39.944: E/Http1(1728): IOException
10-12 10:25:40.414: I/Choreographer(1728): Skipped 178 frames!  The application may be doing too much work on its main thread.
10-12 10:25:41.324: I/Choreographer(1728): Skipped 50 frames!  The application may be doing too much work on its main thread.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值