日期:2014-05-18 浏览次数:20730 次
/**
* 以指定的格式来读取输入流
*/
public static String readStrByCode(InputStream is,String code){
StringBuilder builder=new StringBuilder();
BufferedReader reader=null;
try {
reader = new BufferedReader(new InputStreamReader(is,code));
String line;
while((line=reader.readLine())!=null){
builder.append(line+"\n");
}
} catch (Exception e) {
e.printStackTrace();
}finally{
try {
reader.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return builder.toString();
}