InputStream in = con.getInputStream(); //得到输入流
int n = 0;
byte bytes[] = new byte[1024]; // 用来存放读入的字节
StringBuffer contentBuffer = new StringBuffer(1024*1024); //buffer
while (true) {
try {
n=in.read(bytes); //分批读入buffer中
if (n<0)
break;
String content = new String(bytes,0,n,"UTF-8"); //UTF-8编码
contentBuffer.append(content); //放入buffer中
}catch(Exception e){
}