rt,谢谢。
解决方案 »
- 大家也执行下看,InvokeAndWait方法很霸道,不给其它方法执行的机会。
- JText 的内容判断 高人来啊!
- 一个选择题,请求答案!!
- 一个applet的程序 计算阶乘相加得 帮我看看那错了?怎么改?
- 请教:java中能不能向VC中__LINE__宏一样获取当前的行号,__FILE__获取当前的文件名?
- 求教一个小问题
- 有没有什么系统方法能够将null转成空字符串"",而不是"null"?
- 如何产生20位的随机字符串(在线等)
- 关于session 的问题!
- 请帮我运行一下这段程序
- 这是我写的程序,编译时出现以下错误,请大家帮忙解决,我在线等待...谢谢
- 弹出对话框为什么切换界面时会掩藏到主画面后
StringBuffer out = new StringBuffer();
byte[] b = new byte[4096];
for (int n; (n = in.read(b)) != -1;) {
out.append(new String(b, 0, n));
}
return out.toString();
}
public static String inputStream2String(InputStream is) throws IOException{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int i=-1;
while((i=is.read())!=-1){
baos.write(i);
}
return baos.toString();
}
StringBuffer out = new StringBuffer();
byte[] b = new byte[4096];
for (int n; (n = in.read(b)) != -1;) {
out.append(new String(b, 0, n));
}
return out.toString();
}
或
public static String inputStream2String(InputStream is) throws IOException{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int i=-1;
while((i=is.read())!=-1){
baos.write(i);
}
return baos.toString();
}
都行得通
哈哈