

If you want to control the writer or stream instances yourself, you can use convenient constructor methods such as newWriter, newOutputStream, newDataOutputStream, Within a closure that allows you to write out primitive and serialized Java types respectively.


Io.DataOutputStream and java.io.ObjectOutputStream instances You can also wrap file access using the withDataOutputStream and withObjectOutputStream methods. The stream object will be opened and closed automatically in a similar way to the withWriter method. The leftShift operator is used again to append data to a stream.

Using Groovy as a command-line text file editor.Executing Groovy code from the command line.
