Sandwich Continued 2 - Groovin' with Groovy
import java.io.*
  
useWriter = { file, closure |
    try {                          // Top Bread
        w = new FileWriter(file)   // |
	closure.call(w)            // Meat !!!
    } finally {                    // Bottom Bread
        w.close()                  // |
    }                              // |
}

useWriter(new File("ex15.out")) { x |
    x.write("Hello, World\n")
}

[Example 15 Output]

Example 15