更新时间:2022-11-18 20:07:02
我使用 apache common IO 将文本文件读入单个字符串
I use apache common IO to read a text file into a single string
String str = FileUtils.readFileToString(file);
简单和干净。你甚至可以毫无困难地设置文本文件的编码。
simple and "clean". you can even set encoding of the text file with no hassle.
String str = FileUtils.readFileToString(file, "UTF-8");