http://blog.csdn.net/hanqunfeng/article/details/4364583
1.String to InputStream
String str = "String与InputStream相互转换";
InputStream in_nocode = new ByteArrayInputStream(str.getBytes());
InputStream in_withcode = new ByteArrayInputStream(str.getBytes("UTF-8"));
2.InputStream to String
public static String inputStream2String(InputStream in_st){
BufferedReader in = new BufferedReader(new InputStreamReader(in_st));
StringBuffer buffer = new StringBuffer();
String line = "";
while ((line = in.readLine()) != null){
buffer.append(line);
}
return buffer.toString();
}