public static String readStream(InputStream is){
try {
byte[] bs = new byte[1024] ;
int b = 0 ;
ByteArrayOutputStream baos = new ByteArrayOutputStream() ;
while((b=is.read(bs))!=-1){
baos.write(bs, 0, b) ;
}
baos.close() ;
return new String(bs) ;
} catch (IOException e) {
e.printStackTrace();
}
return null ;
}
时间: 2024-09-30 20:35:18