code: public static long exportCSV(final OutputStream out, final ResultSet rs, final Collection<String> selectColumnNames, final long offset, final long count,
              final boolean writeTitle, final boolean quoted) throws UncheckedSQLException, UncheckedIOException {
          Writer writer = null;
  
          try {
              writer = new OutputStreamWriter(out);
  
              long result = exportCSV(writer, rs, selectColumnNames, offset, count, writeTitle, quoted);
  
              writer.flush();
  
              return result;
          } catch (IOException e) {
              throw new UncheckedIOException(e);
          }
      }
docs: Exports the data from database to CVS.
  
  @param out
  @param rs
  @param selectColumnNames
  @param offset
  @param count
  @param writeTitle
  @param quoted
  @return