Package org.apache.camel.tooling.util
Class FileUtil
java.lang.Object
org.apache.camel.tooling.util.FileUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanupdateFile(Path path, byte[] newdata) Update a file with the given binary content if neeed.static booleanupdateFile(Path path, String newdata) Update a file with the given string content if neeed.static booleanupdateFile(Path path, String newdata, Charset encoding) Update a file with the given string content if neeed.static voidupdateFile(Path from, Path to) Read the content of the input file and update the target accordingly
-
Method Details
-
updateFile
Update a file with the given string content if neeed. The file won't be modified if the content is already the same.- Parameters:
path- the path of the file to updatenewdata- the new string data,nullto delete the file- Returns:
trueif the file was modified,falseotherwise- Throws:
IOException- if an exception occurs
-
updateFile
Update a file with the given string content if neeed. The file won't be modified if the content is already the same.- Parameters:
path- the path of the file to updatenewdata- the new string data,nullto delete the fileencoding- the encoding to use- Returns:
trueif the file was modified,falseotherwise- Throws:
IOException- if an exception occurs
-
updateFile
Update a file with the given binary content if neeed. The file won't be modified if the content is already the same.- Parameters:
path- the path of the file to updatenewdata- the new binary data,nullto delete the file- Returns:
trueif the file was modified,falseotherwise- Throws:
IOException- if an exception occurs
-
updateFile
Read the content of the input file and update the target accordingly- Parameters:
from- the source fileto- the target file- Throws:
IOException- if an exception occurs
-