public Request(InputStream is) throws IOException{
this();
this.is=new BufferedInputStream(is);
//此代码块运行正常。
byte[] flush = new byte[20480];
int len = is.read(flush);
allInfo = new String(flush,0,len);
// byte[] flush = new byte[1024];
// int len =0;
// StringBuilder sb = new StringBuilder();
// try {
// while(-1!=(len=is.read(flush))){
// sb.append(new String(flush,0,len));
// }
// } catch (IOException e) {
// allInfo=null;
// return;
// }
// allInfo = (sb.toString()).trim();
// System.out.println(allInfo);
parseAllInfo();
}
以上代码可顺利运行,但是使用注释部分的代码块进行读取,就会在 while(-1!=(len=is.read(flush)))此行卡住,请问存在什码中题?代码中InputSmtrea is ,是通过(SocketSever.accpt).getinputStream来获取的