java.io.IOException:Attempted read on closed stream.
W/System.err(14042):atorg.apache.http.conn.EofSensorInputStream.isReadAllowed(EofSensorInputStream.java:127)
W/System.err(14042):atorg.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:157)
W/System.err(14042):at java.io.InputStreamReader.read(InputStreamReader.java:244)
W/System.err(14042):at java.io.BufferedReader.fillBuf(BufferedReader.java:130)
W/System.err(14042):at java.io.BufferedReader.readLine(BufferedReader.java:354)
W/System.err(14042):atcom.bonree.brreboot.utill.Send2ServiceUtil.getResult(Send2ServiceUtil.java:35)
W/System.err(14042):atcom.bonree.brreboot.services.BrBootService$1.run(BrBootService.java:81)
W/System.err(14042):at java.lang.Thread.run(Thread.java:856)
-----------------代码-----------
// 发送登录信息
inputStream = clientUtils.sendMsg2BusinessServer(
ConstantValue.BUSINESS_SERVER_URI, Msg);
if (inputStream != null) {
try {
reader = new BufferedReader(new InputStreamReader(inputStream));
//都取受到的消息
while((result = reader.readLine()) != null){//<-------------------这个位置报错
System.out.println("从服务端受到的消息---Send2ServiceUtil------syso------l>: " + result);
return result;
}
} catch (Exception e) {
e.printStackTrace();
} finally {
--------------原因---inputStream--是在- clientUtils.sendMsg2BusinessServer----获取到的------ 在clientUtils.sendMsg2BusinessServer做优化的时候 把要传递的流在finally里面关掉了,去掉关流操作即可