Package org.apache.camel.tooling.util
Class FileUtil
- java.lang.Object
-
- org.apache.camel.tooling.util.FileUtil
-
public final class FileUtil extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 Detail
-
updateFile
public static boolean updateFile(Path path, String newdata) throws IOException
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
public static boolean updateFile(Path path, String newdata, Charset encoding) throws IOException
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
public static boolean updateFile(Path path, byte[] newdata) throws IOException
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
public static void updateFile(Path from, Path to) throws IOException
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
-
-