code: public static void transformLine(Reader reader, Writer writer, @ClosureParams(value=SimpleType.class, options="java.lang.String") Closure closure) throws IOException {
          BufferedReader br = new BufferedReader(reader);
          BufferedWriter bw = new BufferedWriter(writer);
          String line;
          try {
              while ((line = br.readLine()) != null) {
                  Object o = closure.call(line);
                  if (o != null) {
                      bw.write(o.toString());
                      bw.newLine();
                  }
              }
              bw.flush();
  
              Writer temp2 = writer;
              writer = null;
              temp2.close();
              Reader temp1 = reader;
              reader = null;
              temp1.close();
          } finally {
              closeWithWarning(br);
              closeWithWarning(reader);
              closeWithWarning(bw);
              closeWithWarning(writer);
          }
      }
docs: Transforms the lines from a reader with a Closure and
  write them to a writer. Both Reader and Writer are
  closed after the operation.
  
  @param reader  Lines of text to be transformed. Reader is closed afterwards.
  @param writer  Where transformed lines are written. Writer is closed afterwards.
  @param closure Single parameter closure that is called to transform each line of
  text from the reader, before writing it to the writer.
  @throws IOException if an IOException occurs.
  @since 1.0