【发布时间】:2011-05-12 16:47:24
【问题描述】:
可能重复:
How to create a Java String from the contents of a file
您好,我想读取一个文本文件并将消息变成一个字符串。
String message = StringUtils.decode(FileUtils.readFileContent(templateResource.getFile(), templateResource.getCharset(), (int) templateResource.getLength()), notification.getParams());
我对java不是很好,我怎样才能转换它以便它工作? 我要读取的文件补丁是:sms-notification/info-response.1.txt
我不想使用解码功能,因为文本文件的内容只是静态的。
我会做类似的事情吗:
String message = StringUtils.decode(FileUtils.readFileContent("sms-notification/info-response.1.txt".getFile(), templateResource.getCharset(), (int) templateResource.getLength()), notification.getParams()); ?
因为那行不通。
【问题讨论】:
-
同[如何从文件内容创建Java字符串](stackoverflow.com/questions/326390/…)。
标签: java string netbeans text sms