code: public void writeAll(java.sql.ResultSet rs, boolean includeColumnNames)  throws SQLException, IOException {
  
  
          if (includeColumnNames) {
              writeColumnNames(rs);
          }
  
          while (rs.next())
          {
              writeNext(resultService.getColumnValues(rs));
          }
      }
docs: Writes the entire ResultSet to a CSV file.
  
  The caller is responsible for closing the ResultSet.
  
  @param rs the recordset to write
  @param includeColumnNames true if you want column names in the output, false otherwise
  
  @throws java.io.IOException thrown by getColumnValue
  @throws java.sql.SQLException thrown by getColumnValue