Groovy features to write to file
Summary:
Content (required):
I've noticed that Groovy provides various methods to write to files such as CSVWriter and CreateFilePrintWriter.
As I understand, both these methods create a new file or overwrite an existing file that matches the name provided in the parameter.
Rather than creating a new file each time the method is called, what I am looking for is a method that allows us to append lines of text to an existing file.
For example, is it possible to have a groovy script that writes to a file as follows:
createFilePrintWriter("test.txt"){out-> out.println "hello" }
Then have some more groovy script that appends more text to the same file
Tagged:
0