标签:
解析字符串:
封装一个解析字符串的工具类,方便调用
public static String readStream(InputStream is){
try{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = 0;
byte[] buffer = new byte[1024];
while((len = is.read(buffer))!=-1){
baos.write(buffer,0,len);
}
is.close();
bos.close();
byte[] result = baos.toByteArray();
String temp = new String(result);
return temp;
}cath(IOException e){
e.printStackTrace();
return"获取失败";
}
}
标签:
原文地址:http://www.cnblogs.com/the-boy/p/5626299.html