Package org.apache.flink.test.util
Class FileUtils
- java.lang.Object
-
- org.apache.flink.test.util.FileUtils
-
public class FileUtils extends Object
Collection of file-related utilities.
-
-
Constructor Summary
Constructors Constructor Description FileUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PathfindFlinkDist()static voidreplace(Path file, Pattern pattern, Function<Matcher,String> replacer)
-
-
-
Method Detail
-
replace
public static void replace(Path file, Pattern pattern, Function<Matcher,String> replacer) throws IOException
Matches the givenPatternagainst all lines in the given file, and replaces all matches with the replacement generated by the givenFunction. All unmatched lines and provided replacements are written into the file, with the order corresponding to the original content. Newlines are automatically added to each line; this implies that an empty replacement string will result in an empty line to be written.- Throws:
IOException
-
findFlinkDist
public static Path findFlinkDist()
-
-