public class StreamToString {
public static String streamToStr(InputStream inputStream, String chartSet){
StringBuilder builder=new StringBuilder();
try {
BufferedReader br=new BufferedReader(new InputStreamReader(inputStream,chartSet));
String con;
while ((con=br.readLine())!=null){
builder.append(con);
}
br.close();
return builder.toString();
} catch (IOException e) {
e.printStackTrace();
}
return "";
}
}
public static String streamToStr(InputStream inputStream, String chartSet){
StringBuilder builder=new StringBuilder();
try {
BufferedReader br=new BufferedReader(new InputStreamReader(inputStream,chartSet));
String con;
while ((con=br.readLine())!=null){
builder.append(con);
}
br.close();
return builder.toString();
} catch (IOException e) {
e.printStackTrace();
}
return "";
}
}