當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。