public static String ScreamToString(InputStream in) throws Exception{
//定义一个内存输出流
ByteArrayOutputStream out = new ByteArrayOutputStream();
int len=0;
byte[] bt=new byte[1024];
while((len=in.read(bt))!=-1){
out.write(bt,0,len);
}
String content=new String(out.toByteArray());//使用构造函数的原因是
//还可以通过new String(out.toByteArray(),"utf-8")来设置编码
return content;
}