コモンズIO FileUtils.writeStringToFileが廃止されました

岩場:

私は、単一のステートメントでのようなものをファイルにコンテンツを作成する必要があります FileUtils.writeStringToFile

それは推奨されませんので、それに対する任意の代替はあります

ラジェンドラはアローラ:

これを通過することでドキュメント、それはと述べています:

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.

あなたは、この例に従うことができます。

final File file = new File(getTestDirectory(), "file_name.txt");
FileUtils.writeStringToFile(file, "content", "ISO-8859-1");

あなたは渡すことができ(String) nullますが、エンコーディングを渡したくない場合は、あなたの引数に。

詳細については、リンクを通過することができます使用リンク

おすすめ

転載: http://43.154.161.224:23101/article/api/json?id=223625&siteId=1