groovy Groovy vs Java file I/O comparison, and how to improve it using withWriter. I learnt by making a mistake and hope to help someone with this post. This weekend I tried to compare Java file I/O with Groovy on two fronts: a. Code bevity. b.