方法很简单:
String s = "xxxxx";
ByteArrayInputStream is = new ByteArrayInputStream(s.getBytes());
如果要支持中文,只要把第二句改成如下就可以了
ByteArrayInputStream is = new ByteArrayInputStream(s.getBytes("UTF-8"));
方法很简单:
String s = "xxxxx";
ByteArrayInputStream is = new ByteArrayInputStream(s.getBytes());
如果要支持中文,只要把第二句改成如下就可以了
ByteArrayInputStream is = new ByteArrayInputStream(s.getBytes("UTF-8"));