storm-apt/api/src/main/java/com/turbomanage/storm/csv/CsvTableWriter.java
public int dumpToCsv(Context ctx, SQLiteDatabase db, String suffix) throws FileNotFoundException {
		int numRowsWritten = 0;
		Cursor c;
		String filename = getCsvFilename(db.getPath(), db.getVersion(), suffix);
		c = db.query(th.getTableName(), null, null, null, null, null, null);
		FileOutputStream fos;
		fos = ctx.openFileOutput(filename, 0);
		PrintWriter printWriter = new PrintWriter(fos);
		String headerRow = buildHeaderRow();
		printWriter.println(headerRow);
		for (boolean hasItem = c.moveToFirst(); hasItem; hasItem = c
				.moveToNext()) {
			String csv = buildCsvRow(c);
			printWriter.println(csv);
			numRowsWritten++;
		}
		printWriter.flush();
		printWriter.close();
		return numRowsWritten;
	}
public int dumpToCsv(Context ctx, SQLiteDatabase db, String suffix) throws FileNotFoundException {
		int numRowsWritten = 0;
		Cursor c;
		String filename = getCsvFilename(db.getPath(), db.getVersion(), suffix);
		c = db.query(th.getTableName(), null, null, null, null, null, null);
		FileOutputStream fos;
		fos = ctx.openFileOutput(filename, 0);
		PrintWriter printWriter = new PrintWriter(fos);
		String headerRow = buildHeaderRow();
		printWriter.println(headerRow);
		for (boolean hasItem = c.moveToFirst(); hasItem; hasItem = c
				.moveToNext()) {
			String csv = buildCsvRow(c);
			printWriter.println(csv);
			numRowsWritten++;
		}
		printWriter.flush();
		printWriter.close();
		return numRowsWritten;
	}
Dumps a database table to a CSV file in the default location.
Returns the number of rows written to the file.

@param ctx
@param db
@param suffix

@return count of rows in the exported file