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


Java CSVWriter.NO_QUOTE_CHARACTER属性代码示例

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


在下文中一共展示了CSVWriter.NO_QUOTE_CHARACTER属性的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: 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

示例3: doInitialize

@Override
public void doInitialize(UimaContext aContext) throws ResourceInitializationException {
	super.doInitialize(aContext);

	try {
		// Attempt to create the path if it doesn't exist
		new File(filename).getParentFile().mkdirs();

		writer = new CSVWriter(new OutputStreamWriter(new FileOutputStream(filename, false), StandardCharsets.UTF_8), '\t', CSVWriter.NO_QUOTE_CHARACTER);
		
	} catch (final IOException e) {
		throw new ResourceInitializationException(e);
	}

}
 
开发者ID:dstl,项目名称:baleen,代码行数:15,代码来源:AbstractCsvConsumer.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: main

/**
 * @param args yagoFacts.tsv file
 * @throws IOException 
 * @throws FileNotFoundException 
 */
public static void main(String[] args) throws IOException {
	Preconditions.checkArgument(args.length == 1, "Usage: yagofactstomongo path/to/yagoFacts.tsv");
	File yagoFactsTsvFile = new File(args[0]);
	log.info("Importing '{}'...", yagoFactsTsvFile);
	MongoClient mongo = new MongoClient(new MongoClientURI("mongodb://localhost/"));
	DB db = mongo.getDB("lumen_lumen_dev");
	DBCollection factColl = db.getCollection("fact");
	log.info("Dropping fact collection...");
	factColl.drop();
	log.info("Fact collection dropped");
	int factCount = 0;
	try (CSVReader reader = new CSVReader(new FileReader(yagoFactsTsvFile), '\t', CSVWriter.NO_QUOTE_CHARACTER)) {
		List<DBObject> dbos = new ArrayList<>();
		while (true) {
			String[] row = reader.readNext();
			if (row == null || row.length == 0) {
				break;
			}
			BasicDBObject dbo = new BasicDBObject(ImmutableMap.of(
					//"_id", removeBrackets(row[0]),
					"s", removeBrackets(row[1]),
					"p", removeBrackets(row[2]),
					"o", removeBrackets(row[3])));
			dbos.add(dbo);
			log.trace("Inserting {}...", dbo);
			factCount++;
			if (factCount % 10000 == 0) {
				insert(factColl, dbos);
				dbos.clear();
				log.info("Inserted {} facts", factCount);
			}
		}
		if (!dbos.isEmpty()) {
			insert(factColl, dbos);
		}
		dbos.clear();
		log.info("Inserted {} facts", factCount);
	}
	log.info("Imported {} facts", factCount);
	log.info("Creating index...");
	factColl.ensureIndex(new BasicDBObject("p", 1));
	log.info("Index created");
}
 
开发者ID:lumenrobot,项目名称:lumen-kb,代码行数:48,代码来源:YagoFactsToMongo.java


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