int i = -1;
//org.apache.commons.io.output.ByteArrayOutputStream
ByteArrayOutputStream baos = new ByteArrayOutputStream();
while ((i = is.read()) != -1) {
baos.write(i);
}
String content = baos.toString();
int i = -1;
byte[] b = new byte[1024];
StringBuffer sb = new StringBuffer();
while ((i = is.read(b)) != -1) {
sb.append(new String(b, 0, i));
}
String content = sb.toString();
java中把流转换成字符串
最新推荐文章于 2024-07-20 03:20:49 发布