当前位置: 首页>>代码示例>>Java>>正文


Java CSVWriter.DEFAULT_SEPARATOR属性代码示例

本文整理汇总了Java中com.opencsv.CSVWriter.DEFAULT_SEPARATOR属性的典型用法代码示例。如果您正苦于以下问题:Java CSVWriter.DEFAULT_SEPARATOR属性的具体用法?Java CSVWriter.DEFAULT_SEPARATOR怎么用?Java CSVWriter.DEFAULT_SEPARATOR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.opencsv.CSVWriter的用法示例。


在下文中一共展示了CSVWriter.DEFAULT_SEPARATOR属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialise

@Override
public void initialise() throws IOException {
	// Create the parent dirs
	new File(csvFilename).getAbsoluteFile().getParentFile().mkdirs();

	writer = new CSVWriter(new FileWriter(csvFilename, false), CSVWriter.DEFAULT_SEPARATOR, CSVWriter.NO_QUOTE_CHARACTER);

	// Print the header
	writer.writeNext(new String[] {
			"Type",
			"Subtype",
			"Source type",
			"Target type",
			"Lemma",
			"Lemma POS",
			"Alternatives...."
	});
}
 
开发者ID:dstl,项目名称:baleen,代码行数:18,代码来源:CsvInteractionWriter.java

示例2: detectSeparator

public static char detectSeparator(String line) {
    StringBuffer buffer = new StringBuffer();
    Matcher matcher = UNIVERSAL_ALIAS_PATTERN.matcher(line);
    while (matcher.find()) {
        matcher.appendReplacement(buffer, "");
    }
    matcher.appendTail(buffer);

    String separateDetection = buffer.toString().replaceAll("[^,;|\\t]*", "");
    if (separateDetection == null)
        throw new ReportFormattingException("Error while detecting a separator");

    if (!separateDetection.isEmpty())
        return separateDetection.charAt(0);
    else
        return CSVWriter.DEFAULT_SEPARATOR;
}
 
开发者ID:cuba-platform,项目名称:yarg,代码行数:17,代码来源:SimpleSeparatorDetector.java

示例3: save

/**
 * <p>Saves the table values to the given file.</p>
 * @param file
 * @throws IOException
 */
public void save(File file) throws IOException {
	CSVWriter writer = new CSVWriter(new FileWriter(file, true), CSVWriter.DEFAULT_SEPARATOR, CSVWriter.NO_QUOTE_CHARACTER);
	int rowCount = model.getRowCount();
	int columnCount = model.getColumnCount();
	for(int i = 0; i < rowCount; i++) {
		String[] row = new String[columnCount];
		for(int a = 0; a < columnCount; a++) {
			row[a] = String.valueOf(model.getValueAt(i, a));
		}
		writer.writeNext(row);
	}
	writer.close();
}
 
开发者ID:martinwithaar,项目名称:EmDrive,代码行数:18,代码来源:AnalysisPanel.java

示例4: runTask

private boolean runTask() {
	if (mAdapter == null || mAdapter.getCursor() == null)
		return false;
	// take cursor
	Cursor data = mAdapter.getCursor();
	// create object to write csv file
	try {
		CSVWriter csvWriter = new CSVWriter(new FileWriter(mFileName), CSVWriter.DEFAULT_SEPARATOR,
				CSVWriter.NO_QUOTE_CHARACTER);
		while (data.moveToNext()) {
			String[] record = new String[7];
			// compose a records
			record[0] = data.getString(data.getColumnIndex(QueryAllData.UserDate));
			if (!TextUtils.isEmpty(data.getString(data.getColumnIndex(QueryAllData.Payee)))) {
				record[1] = data.getString(data.getColumnIndex(QueryAllData.Payee));
			} else {
				record[1] = data.getString(data.getColumnIndex(QueryAllData.AccountName));
			}
			record[2] = Double.toString(data.getDouble(data.getColumnIndex(QueryAllData.Amount)));
			record[3] = data.getString(data.getColumnIndex(QueryAllData.Category));
			record[4] = data.getString(data.getColumnIndex(QueryAllData.Subcategory));
			record[5] = Integer.toString(data.getInt(data.getColumnIndex(QueryAllData.TransactionNumber)));
			record[6] = data.getString(data.getColumnIndex(QueryAllData.Notes));
			// writer record
			csvWriter.writeNext(record);
			// move to next row
			data.moveToNext();
		}
		csvWriter.close();
	} catch (Exception e) {
		Timber.e(e, "exporting to CSV");

		return false;
	}
	return true;
}
 
开发者ID:moneymanagerex,项目名称:android-money-manager-ex,代码行数:36,代码来源:ExportToCsvFile.java

示例5: export

static int export(Database db, String tableName, Writer csv, boolean withHeader, boolean applyQuotesToAll, String nullText) throws IOException{
	Table table = db.getTable(tableName);
	String[] buffer = new String[table.getColumnCount()];
	CSVWriter writer = new CSVWriter(new BufferedWriter(csv), CSVWriter.DEFAULT_SEPARATOR, CSVWriter.DEFAULT_QUOTE_CHARACTER);
	int rows = 0;
	try{
		if (withHeader) {
			int x = 0;
			for(Column col : table.getColumns()){
				buffer[x++] = col.getName();
			}
			writer.writeNext(buffer, applyQuotesToAll);
		}
           
		for(Row row : table){
			int i = 0;
			for (Object object : row.values()) {
				buffer[i++] = object == null ? nullText : object.toString();
			}
			writer.writeNext(buffer, applyQuotesToAll);
			rows++;
		}
	}finally{
		writer.close();
	}
	return rows;
}
 
开发者ID:AccelerationNet,项目名称:access2csv,代码行数:27,代码来源:Driver.java


注:本文中的com.opencsv.CSVWriter.DEFAULT_SEPARATOR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。