FileMethods
The FileMethods
class contains one-liner methods
for reading and writing files in both Groovy and Gloop services.
Here are some example usages:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | // Declare a file object def file = new File("packages/using-one-liners/resources/hello.txt") // Declare a string object def message = "Hello World!" // Write to file file.writeStringToFile(message) // Read the contents of the file def contents = file.readFileToString() // Assert that the contents of the file is the message assert contents == message |