title: Java CSVWriter adding blank line at the end of file
body: <p>CSVWriter's last parameter is the lineEnd - since I want a new line after every row, I have been putting &quot;\r\n&quot; and it's been working well for me.</p>
  <p>However, I realize that it is adding a blank line at the end of the file I'm assuming because of this. Is there a way I can get it to not add that blank line without having to read the file again?</p>
  <p>Here is my code:</p>
  <pre><code>        try (PreparedStatement ps = extractTest.Connection.prepareStatement(extractTest.querySQL); ResultSet rs = ps.executeQuery()) {
              @SuppressWarnings(&quot;resource&quot;)  
              CSVWriter writer = new CSVWriter(out, separator, quoteChar, escapeChar, &quot;\r\n&quot;);
              writer.setResultService(rsHelper);
              writer.writeAll(rs, extractTest.headerRow);
              writer.flush();
              writer.close();
          }
  </code></pre>
  <p>This code adds a blank line at the end of the file - any ideas?</p>