title: Puzzle with FileWriter in Groovy
body: <p>I have Groovy code like this...</p>
  
  <pre><code>class GuiWindow extends SwingBuilder {
  
  ....
  FileWriter writer
  
      GuiWindow(def controller)
  {
      ....
      writer = new FileWriter("DATA${new Date().time.toString()}.txt")
      writer.write("Count, Rate\n")
  </code></pre>
  
  <p>This code successfully creates the file but seemingly refuses to write anything into it - not even the header line of text in the immediate next statement.</p>
  
  <p>I have used very similar code before without any problem so am at a bit of a loss as to know what is wrong.</p>
  
  <p>I don't <code>close()</code> the writer - it is meant to be open to record data which comes in slowly - so the one thing I can think of is that the writing is batched and only written when a buffer overflows - but can someone tell me what is wrong with my code or why it doesn't behave the way I expect it to?</p>