java IO

StringWriter writer = new StringWriter();

new StringReader(xml)

如果是用URLConnection,记得要设置超时时间,要不然一直占用资源不结束。

con.setConnectTimeout(30000);
con.setReadTimeout(30000);

原文地址:https://www.cnblogs.com/angelshelter/p/5371006.html