Android字节流转换成字符串
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 }