//将字节输入流转为字符串
public static String readStream(InputStream is){
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len = 0;
while ((len = is.read(buffer)) != -1){
bos.write(buffer,0,len);
}
is.close();
return bos.toString();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
StringUtil
最新推荐文章于 2023-01-28 18:56:30 发布