public static < T > T withWriter ( Path self , String charset , @ ClosureParams ( value = SimpleType . class , options = "java.io.Writer" ) Closure < T > closure ) throws IOException { return withWriter ( self , charset , false , closure ) ; }
Creates a new BufferedWriter for this file passes it to the closure and ensures the stream is flushed and closed after the closure returns . The writer will use the given charset encoding but will not write a BOM .