有没有办法将资源中的文本文件读入字符串?
我想这是一个流行的要求,但在谷歌搜索后我找不到任何实用工具。
Yes, Guava http://code.google.com/p/guava-libraries/在Resources https://google.github.io/guava/releases/snapshot/api/docs/com/google/common/io/Resources.html班级。例如:
URL url = Resources.getResource("foo.txt");
String text = Resources.toString(url, StandardCharsets.UTF_8);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)