FileUtils.writeStringToFile 需要添加新的字符集参数

根据 JavaDoc

@Deprecated

Deprecated. 2.5 use writeStringToFile(File, String, Charset) instead

Writes a String to a file creating the file if it does not exist using the default encoding for the VM.

FileUtils.writeStringToFile(new File(CDNFilePath + "id.txt"), newestSearchID.toString());

将会出现提示,这个方法将会在后续的版本中不再使用。

需要在方法中添加字符集参数。

可以将方法修改为:

FileUtils.writeStringToFile(new File(CDNFilePath + "id.txt"), newestSearchID.toString(), StandardCharsets.UTF_8);

默认情况下,我们使用 UTF-8 字符集。