Class FileUtils


  • public class FileUtils
    extends Object
    Collection of file-related utilities.
    • Constructor Detail

      • FileUtils

        public FileUtils()
    • Method Detail

      • replace

        public static void replace​(Path file,
                                   Pattern pattern,
                                   Function<Matcher,​String> replacer)
                            throws IOException
        Matches the given Pattern against all lines in the given file, and replaces all matches with the replacement generated by the given Function. 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()