1 public static String parserInputStream(InputStream is) throws IOException{
 2                 // 把输入流转换成 字符串 
 3                 InputStreamReader isr=new InputStreamReader(is);
 4                 BufferedReader br=new BufferedReader(isr);
 5                 
 6                 // 内存流 写入读取的数据 
 7                 StringWriter sw=new StringWriter();
 8                 
 9                 String str=null;
10                 while((str=br.readLine())!=null){
11                         sw.write(str);
12                 }
13                 
14                 br.close();
15                 sw.close();
16                 return sw.toString();
17         }

 

相关文章:

  • 2021-11-07
  • 2022-12-23
  • 2021-12-20
猜你喜欢
  • 2021-09-08
  • 2021-11-12
  • 2022-12-23
  • 2021-06-20
  • 2021-07-21
  • 2022-01-16
  • 2021-08-12
相关资源
相似解决方案