android
将输入流转换为字符串的工具类
public class StreamTool{
把一个inputstream 转换为String
public static String readStream(InputStream in) throw Exception{
定义内存输出流
ByteArrayoutputStream bt = new ByteArrayoutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while(len = in.read(buffer))!=-1){
bt.write(buffer, 0,len);
}
in.close;
String content = new String (bt.toByteArray());
}