question: public static void modifyFile ( File file , Function < String , String > modifier ) throws IOException { String content = new String ( Files . toByteArray ( file ) , StandardCharsets . UTF_8 ) ; String result = modifier . apply ( content ) ; Files . write ( result . getBytes ( StandardCharsets . UTF_8 ) , file ) ; }
target:  Modifies the given file in place. 