Heads-up on File and Stream groovy methods
Over the week-end, I implemented new groovy methods, as defined in GROOVY-208 Plus a few complementary methods.
getText()
:BufferedReader.getText()
File.getText()
File.getText(encoding)
Process.getText()
You can now easily read the full content of a file or of a buffered reader and get it as a String.
// retrieve the content of the file
def content = new File("myFile.txt").text
// you can specify the encoding of the file
// note that since getText() has a parameter,
// you cannot call it with something like text("UTF-8")
content = new File("myFile.txt").getText("UTF-8")
There is also a getText() method on Process which gathers the output of a process:
Read more...