當前位置: 首頁>>代碼示例>>Java>>正文


Java CSVWriter.NO_QUOTE_CHARACTER屬性代碼示例

本文整理匯總了Java中au.com.bytecode.opencsv.CSVWriter.NO_QUOTE_CHARACTER屬性的典型用法代碼示例。如果您正苦於以下問題:Java CSVWriter.NO_QUOTE_CHARACTER屬性的具體用法?Java CSVWriter.NO_QUOTE_CHARACTER怎麽用?Java CSVWriter.NO_QUOTE_CHARACTER使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在au.com.bytecode.opencsv.CSVWriter的用法示例。


在下文中一共展示了CSVWriter.NO_QUOTE_CHARACTER屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: exportToCSV

@Override
public void exportToCSV(File f) {
	/*
	 * Row = Series
	 * Columns = Datapoints
	 */
	try {
		/* Instantiate the CSVWriter */
		CSVWriter csvWriter = new CSVWriter(new FileWriter(f), ',',	CSVWriter.NO_QUOTE_CHARACTER);
		List<String[]> forExport = new LinkedList<String[]>();	
		
		/* Gather data */
		Map<Comparable, Collection<? extends Number>> data = getData();
		
		for (int seriesIndex=0; seriesIndex<histogramDataset.getSeriesCount(); seriesIndex++) {			
			Collection<? extends Number> datapoints = data.get(seriesIndex);			
			Collection<String> values = new LinkedList<String>();
			
			/* Add information about series */
			Comparable seriesKey = histogramDataset.getSeriesKey(seriesIndex);
			values.add(seriesKey.toString());
			
			/* Convert data */
			for (Number datapoint : datapoints) {			
				/* Add information per datapoint */
				values.add(datapoint.toString());
			}
			
			forExport.add(values.toArray(new String[values.size()]));
		}
		
		/* Write content to file */
		csvWriter.writeAll(forExport);
		csvWriter.close();
	} catch (IOException e) {
		logger.error("There was a problem with writing the file", e);
	}
}
 
開發者ID:modsim,項目名稱:vizardous,代碼行數:38,代碼來源:DistributionChart2D.java

示例2: readTsvIntoMatrix

/**
 * Reads a very basic tsv (numbers separated by tabs) into a RealMatrix.
 * <p>Very little error checking happens in this method</p>
 *
 * @param inputFile readable file.  Not {@code null}
 * @return never {@code null}
 */
public static RealMatrix readTsvIntoMatrix(final File inputFile) {
    IOUtils.canReadFile(inputFile);
    final List<double []> allData = new ArrayList<>();
    int ctr = 0;
    try {

        final CSVReader reader = new CSVReader(new FileReader(inputFile), '\t', CSVWriter.NO_QUOTE_CHARACTER);
        String[] nextLine;
        while ((nextLine = reader.readNext()) != null) {
            ctr++;
            allData.add(Arrays.stream(nextLine).filter(s -> StringUtils.trim(s).length() > 0).map(s -> Double.parseDouble(StringUtils.trim(s))).mapToDouble(d -> d).toArray());
        }
    } catch (final IOException ioe) {
        Assert.fail("Could not open test file: " + inputFile, ioe);
    }
    final RealMatrix result = new Array2DRowRealMatrix(allData.size(), allData.get(0).length);
    for (int i = 0; i < result.getRowDimension(); i++) {
        result.setRow(i, allData.get(i));
    }
    return result;
}
 
開發者ID:broadinstitute,項目名稱:gatk-protected,代碼行數:28,代碼來源:PoNTestUtils.java

示例3: getWriter

protected synchronized CSVWriter getWriter() throws IOException {
    if (this.csvWriter == null) {
        FileOutputStream fos = new FileOutputStream(this.fileName, appendToFile); // always append, 
        OutputStreamWriter writer = new OutputStreamWriter(fos, "UTF-8");
        this.csvWriter = new CSVWriter( writer,
            separator,
            useQuotes ? CSVWriter.DEFAULT_QUOTE_CHARACTER : CSVWriter.NO_QUOTE_CHARACTER,
            System.getProperty("line.separator"));
    }
    return this.csvWriter;
}
 
開發者ID:dbarowy,項目名稱:java-aws-mturk,代碼行數:11,代碼來源:HITDataCSVWriter.java

示例4: saveCategoriesToFile

/**
 * Writes all category entries to the specified csv file.
 * 
 * @param filePath
 */
private void saveCategoriesToFile(String filePath) {
	
	try
	{
		CSVWriter writer = new CSVWriter(new FileWriter(filePath), CSVWriter.DEFAULT_SEPARATOR, CSVWriter.NO_QUOTE_CHARACTER, "\r\n");
		ArrayList<FHCategoryEntry> categoryEntries = getAllCategoryEntries();
		
		String[] headerLine = new String[FHCategoryReader.NUM_COLUMNS_IN_FILE];
		headerLine[FHCategoryReader.INDEX_OF_HEADER] = FHCategoryReader.FHAES_CATEGORY_FILE_HEADER;
		headerLine[FHCategoryReader.INDEX_OF_VERSION] = FHCategoryReader.FHAES_CATEGORY_FILE_VERSION;
		headerLine[FHCategoryReader.INDEX_OF_FILENAME] = workingFile.getFileNameWithoutExtension();
		writer.writeNext(headerLine);
		
		for (int i = 0; i < categoryEntries.size(); i++)
		{
			String[] nextLine = new String[FHCategoryReader.NUM_COLUMNS_IN_FILE];
			nextLine[FHCategoryReader.INDEX_OF_SERIES_TITLE] = categoryEntries.get(i).getSeriesTitle();
			nextLine[FHCategoryReader.INDEX_OF_CATEGORY] = categoryEntries.get(i).getCategory();
			nextLine[FHCategoryReader.INDEX_OF_CONTENT] = categoryEntries.get(i).getContent();
			writer.writeNext(nextLine);
		}
		
		writer.close();
		
		MainWindow.getInstance().getFeedbackMessagePanel().updateFeedbackMessage(FeedbackMessageType.INFO,
				FeedbackDisplayProtocol.AUTO_HIDE, FeedbackDictionary.CATEGORY_FILE_SAVED_MESSAGE.toString());
	}
	catch (IOException ex)
	{
		ex.printStackTrace();
	}
}
 
開發者ID:petebrew,項目名稱:fhaes,代碼行數:37,代碼來源:CategoryEditor.java

示例5: writeMatrix

private void writeMatrix(final RealMatrix m, final File outputFilename) throws IOException {
    final List<String []> textTable = new ArrayList<>();
    for (int i = 0; i < m.getRowDimension(); i ++){
        textTable.add(Arrays.stream(m.getRow(i)).mapToObj(Double::toString).toArray(String[]::new));
    }
    final FileWriter fw = new FileWriter(outputFilename);
    CSVWriter csvWriter = new CSVWriter(fw, '\t', CSVWriter.NO_QUOTE_CHARACTER);
    csvWriter.writeAll(textTable);
    csvWriter.flush();
    csvWriter.close();
}
 
開發者ID:broadinstitute,項目名稱:gatk-protected,代碼行數:11,代碼來源:DecomposeSingularValues.java

示例6: main

public static void main( String[] args ) throws IOException
{
	Preconditions.checkArgument(args.length == 2, "Usage: wn30msa-to-wn31 path/to/wn-msa-all.tab dest/dir");
	
	File wn30coreFile = new File(args[0]);
	File wn31TsvFile = new File(args[1], "wn31-msa-all.tab");
	log.info("Loading wn30-msa '{}' (and converting to wn31-msa '{}')...", wn30coreFile, wn31TsvFile);
	int index = 1;
	try (CSVWriter writer = new CSVWriter(new FileWriter(wn31TsvFile), '\t', CSVWriter.NO_QUOTE_CHARACTER)) {
    	try (CSVReader reader = new CSVReader(new FileReader(wn30coreFile), '\t')) {
    		while (true) {
    			String[] row = reader.readNext();
    			if (row == null) {
    				break;
    			}
    			String wn30sense = row[0];
    			char posLetter = wn30sense.charAt(9);
    			final Integer posNumeric = Preconditions.checkNotNull(Wn30ToWn31.POS_NUMERIC.get(posLetter),
    					"Invalid part-of-speech letter code '%s' for sense '%s'", posLetter, wn30sense);
				String wn31sense = posNumeric + wn30sense;
				
				writer.writeNext(new String[] { wn31sense, row[1], row[2], row[3] });
				index++;
    		}
    	}
	}
	
	log.info("Converted {} rows", index);
}
 
開發者ID:lumenrobot,項目名稱:wordnet-extras,代碼行數:29,代碼來源:Wn30MsaToWn31.java

示例7: export

public int export(String path) throws IOException {
	List<Address> addresses = (List<Address>) addressRepo.all().filter("self.certifiedOk IS FALSE").fetch();
	
	CSVWriter csv = new CSVWriter(new java.io.FileWriter(path), "|".charAt(0), CSVWriter.NO_QUOTE_CHARACTER);
	List<String> header = new ArrayList<String>();
	header.add("Id");
	header.add("AddressL1");
	header.add("AddressL2");
	header.add("AddressL3");
	header.add("AddressL4");
	header.add("AddressL5");
	header.add("AddressL6");
	header.add("CodeINSEE");
	
	csv.writeNext(header.toArray(new String[header.size()]));
	List<String> items = new ArrayList<String>();
	for (Address a : addresses) {
		
		items.add(a.getId() != null ? a.getId().toString(): "");
		items.add(a.getAddressL2() != null ? a.getAddressL2(): "");
		items.add(a.getAddressL3() != null ? a.getAddressL3(): "");
		items.add(a.getAddressL4() != null ? a.getAddressL4(): "");
		items.add(a.getAddressL5() != null ? a.getAddressL5(): "");
		items.add(a.getAddressL6() != null ? a.getAddressL6(): "");
		items.add(a.getInseeCode() != null ? a.getInseeCode(): "");
		
		csv.writeNext(items.toArray(new String[items.size()]));
		items.clear();
	}
	csv.close();
	LOG.info("{} exported", path);
	
	return addresses.size();
}
 
開發者ID:axelor,項目名稱:axelor-business-suite,代碼行數:34,代碼來源:AddressServiceImpl.java

示例8: exportConcept

/**
 * Export concept to SNOMED CT Release Format 2.
 * @param conceptId
 * @throws DrugMatchConfigurationException
 * @throws IOException
 */
private void exportConcept(final String conceptId) throws DrugMatchConfigurationException, IOException {
	boolean addHeader = false;
	if (this.fileNameConcept == null) {
		this.fileNameConcept = DrugMatchProperties.getTerminologyDirectory().getPath() + File.separator + "sct2_Concept_DrugMatch_" + this.isoNow + ".txt";
		addHeader = true;
	}
	try (CSVWriter writer = new CSVWriter(new OutputStreamWriter(new FileOutputStream(this.fileNameConcept,
							!addHeader), // append
					CharEncoding.UTF_8),
			ReleaseFormat2.FILE_CONTENT_SEPARATOR_CHARACTER,
			CSVWriter.NO_QUOTE_CHARACTER,
			ReleaseFormat2.NEW_LINE)) {
		// header
		if (addHeader) {
			writer.writeNext(new String[] {
					"id",
					"effectiveTime",
					"active",
					"moduleId",
					"definitionStatusId"
			});
			log.info("Created {}", this.fileNameConcept);
		}
		// content
		writer.writeNext(new String[] {
				conceptId,
				this.effectiveTime,
				ReleaseFormat2.STATUS_ACTIVE_ID,
				DrugMatchProperties.getModuleId(),
				ReleaseFormat2.CONCEPT_DEFINITION_STATUS_PRIMITIVE_ID
		});
		writer.flush();
	}
}
 
開發者ID:IHTSDO,項目名稱:drugMatch,代碼行數:40,代碼來源:Create.java

示例9: exportMapping

/**
 * Export 1-1 mapping: Drug ID to SCT Concept ID.
 * @param pharmaceutical2ConceptId
 * @throws DrugMatchConfigurationException
 * @throws IOException
 */
private void exportMapping(final Map<Pharmaceutical, String> pharmaceutical2ConceptId) throws DrugMatchConfigurationException, IOException {
	if (pharmaceutical2ConceptId.size() > 0) {
		log.info("Starting \"Create\" mapping export");
		String fullFileName = DrugMatchProperties.getMappingDirectory().getPath() + File.separator + "mapping_" + this.isoNow + ".csv";
		String quoteCharacter = DrugMatchProperties.getFileContentQuoteCharacter();
		char quoteChar = (quoteCharacter == null) ? CSVWriter.NO_QUOTE_CHARACTER : quoteCharacter.charAt(0);
		try (CSVWriter writer = new CSVWriter(new OutputStreamWriter(new FileOutputStream(fullFileName),
				CharEncoding.UTF_8),
				Check.getOutputFileContentSeparator(),
				quoteChar,
				System.lineSeparator())) {
			// header
			writer.writeNext(new String[] {
					"Drug ID",
					"SCT Concept ID"
			});
			// content
			for (Map.Entry<Pharmaceutical, String> entry : pharmaceutical2ConceptId.entrySet()) {
				writer.writeNext(new String[] {
						entry.getKey().drugId,
						entry.getValue()
				});
			}
			writer.flush();
			log.info("Created {}", fullFileName);
		}
		log.info("Completed \"Create\" mapping export");
	} else {
		log.debug("Skipping mapping export, cause: no data available");
	}
}
 
開發者ID:IHTSDO,項目名稱:drugMatch,代碼行數:37,代碼來源:Create.java

示例10: exportPreferredEnglishToLanguageReferenceSet

/**
 * Export English description to SNOMED CT Release Format 2 Language Reference Set.
 * @param descriptionId
 * @throws DrugMatchConfigurationException
 * @throws IOException
 */
private void exportPreferredEnglishToLanguageReferenceSet(final String descriptionId) throws DrugMatchConfigurationException, IOException {
	boolean addHeader = false;
	if (this.fileNameReferenceSetLanguageEnglish == null) {
		this.fileNameReferenceSetLanguageEnglish = DrugMatchProperties.getReferenceSetLanguageDirectory().getPath() + File.separator + "der2_cRefset_Language_DrugMatch_" + ReleaseFormat2.LANGUAGE_EN_CODE + "_" + this.isoNow + ".txt";
		addHeader = true;
	}
	try (CSVWriter writer = new CSVWriter(new OutputStreamWriter(new FileOutputStream(this.fileNameReferenceSetLanguageEnglish,
							!addHeader), // append
					CharEncoding.UTF_8),
			ReleaseFormat2.FILE_CONTENT_SEPARATOR_CHARACTER,
			CSVWriter.NO_QUOTE_CHARACTER,
			ReleaseFormat2.NEW_LINE)) {
		// header
		if (addHeader) {
			writer.writeNext(LANGUAGE_REFSET_HEADER);
			log.info("Created {}", this.fileNameReferenceSetLanguageEnglish);
		}
		// content
		writer.writeNext(new String[] {
				UUID.randomUUID().toString(), // UUID v4 as defined by Robert Turnbull (20140603, [email protected])
				this.effectiveTime,
				ReleaseFormat2.STATUS_ACTIVE_ID,
				DrugMatchProperties.getModuleId(),
				ReleaseFormat2.REFERENCE_SET_LANGUAGE_US_ENGLISH_ID,
				descriptionId,
				ReleaseFormat2.META_DATA_ACCEPTABILITY_PREFERRED_ID
		});
		writer.flush();
	}
}
 
開發者ID:IHTSDO,項目名稱:drugMatch,代碼行數:36,代碼來源:Create.java

示例11: exportPreferredNationalToLanguageReferenceSet

/**
 * Export national description to SNOMED CT Release Format 2 Language Reference Set.
 * @param descriptionId
 * @throws DrugMatchConfigurationException
 * @throws IOException
 */
private void exportPreferredNationalToLanguageReferenceSet(final String descriptionId) throws DrugMatchConfigurationException, IOException {
	boolean addHeader = false;
	if (this.fileNameReferenceSetLanguageNational == null) {
		this.fileNameReferenceSetLanguageNational = DrugMatchProperties.getReferenceSetLanguageDirectory().getPath() + File.separator + "der2_cRefset_Language_DrugMatch_" + DrugMatchProperties.getNationalLanguageCode() + "_" + this.isoNow + ".txt";
		addHeader = true;
	}
	try (CSVWriter writer = new CSVWriter(new OutputStreamWriter(new FileOutputStream(this.fileNameReferenceSetLanguageNational,
							!addHeader), // append
					CharEncoding.UTF_8),
			ReleaseFormat2.FILE_CONTENT_SEPARATOR_CHARACTER,
			CSVWriter.NO_QUOTE_CHARACTER,
			ReleaseFormat2.NEW_LINE)) {
		// header
		if (addHeader) {
			writer.writeNext(LANGUAGE_REFSET_HEADER);
			log.info("Created {}", this.fileNameReferenceSetLanguageNational);
		}
		// content
		writer.writeNext(new String[] {
				UUID.randomUUID().toString(), // UUID v4 as defined by Robert Turnbull (20140603, [email protected])
				this.effectiveTime,
				ReleaseFormat2.STATUS_ACTIVE_ID,
				DrugMatchProperties.getModuleId(),
				DrugMatchProperties.getLanguageReferenceSetId(),
				descriptionId,
				ReleaseFormat2.META_DATA_ACCEPTABILITY_PREFERRED_ID
		});
		writer.flush();
	}
}
 
開發者ID:IHTSDO,項目名稱:drugMatch,代碼行數:36,代碼來源:Create.java

示例12: reportCoreConcept

/**
 * Export concept to "Create" report.
 * @param conceptId
 * @param fullySpecifiedName
 * @throws DrugMatchConfigurationException
 * @throws IOException
 */
private void reportCoreConcept(final String conceptId,
		String fullySpecifiedName) throws DrugMatchConfigurationException, IOException {
	boolean addHeader = false;
	if (this.fileNameReportCoreConcept == null) {
		this.fileNameReportCoreConcept = DrugMatchProperties.getReportDirectory().getPath() + File.separator + "create_generic_pharmaceutical_" + this.isoNow + ".txt";
		addHeader = true;
	}
	String quoteCharacter = DrugMatchProperties.getFileContentQuoteCharacter();
	char quoteChar = (quoteCharacter == null) ? CSVWriter.NO_QUOTE_CHARACTER : quoteCharacter.charAt(0);
	try (CSVWriter writer = new CSVWriter(new OutputStreamWriter(new FileOutputStream(this.fileNameReportCoreConcept,
							!addHeader), // append
					CharEncoding.UTF_8),
			Check.getOutputFileContentSeparator(),
			quoteChar,
			System.lineSeparator())) {
		// header
		if (addHeader) {
			writer.writeNext(REPORT_HEADER);
			log.info("Created {}", this.fileNameReportCoreConcept);
		}
		// content
		writer.writeNext(new String[] {
				conceptId,
				fullySpecifiedName
		});
		writer.flush();
	}
}
 
開發者ID:IHTSDO,項目名稱:drugMatch,代碼行數:35,代碼來源:Create.java

示例13: reportExtensionConcept

/**
 * Export concept to "Create" report.
 * @param conceptId
 * @param fullySpecifiedName
 * @throws DrugMatchConfigurationException
 * @throws IOException
 */
private void reportExtensionConcept(final String conceptId,
		String fullySpecifiedName) throws DrugMatchConfigurationException, IOException {
	boolean addHeader = false;
	if (this.fileNameReportExtensionConcept == null) {
		this.fileNameReportExtensionConcept = DrugMatchProperties.getReportDirectory().getPath() + File.separator + "create_national_pharmaceutical_" + this.isoNow + ".txt";
		addHeader = true;
	}
	String quoteCharacter = DrugMatchProperties.getFileContentQuoteCharacter();
	char quoteChar = (quoteCharacter == null) ? CSVWriter.NO_QUOTE_CHARACTER : quoteCharacter.charAt(0);
	try (CSVWriter writer = new CSVWriter(new OutputStreamWriter(new FileOutputStream(this.fileNameReportExtensionConcept,
							!addHeader), // append
					CharEncoding.UTF_8),
			Check.getOutputFileContentSeparator(),
			quoteChar,
			System.lineSeparator())) {
		// header
		if (addHeader) {
			writer.writeNext(REPORT_HEADER);
			log.info("Created {}", this.fileNameReportExtensionConcept);
		}
		// content
		writer.writeNext(new String[] {
				conceptId,
				fullySpecifiedName
		});
		writer.flush();
	}
}
 
開發者ID:IHTSDO,項目名稱:drugMatch,代碼行數:35,代碼來源:Create.java

示例14: arrayToCSV

/**
 * Create CSV file out of the content of the entries array.
 * 
 * @param entries
 *          List of entry arrays. Each array represents one entry in the file.
 * @throws SQLException
 */
public void arrayToCSV(ArrayList<String[]> entries) throws IOException,
    SQLException {
  CSVWriter writer = new CSVWriter(new FileWriter(filePath), ',',
      CSVWriter.NO_QUOTE_CHARACTER);
  for (String[] entry : entries) {
    writer.writeNext(entry);
  }
  writer.close();
}
 
開發者ID:gausss,項目名稱:MuSe,代碼行數:16,代碼來源:FileProvider.java

示例15: exportToCSV

@Override
public void exportToCSV(File f) {
	/*
	 * Row = Cell ID XX
	 * Column = Timepoint
	 */
	try {
		/* Instantiate the CSVWriter */
		CSVWriter csvWriter = new CSVWriter(new FileWriter(f), ',',	CSVWriter.NO_QUOTE_CHARACTER);

		List<String[]> forExport = new LinkedList<String[]>();

		/* Generate header */
		List<String> header = new ArrayList<String>();
		header.add("Time");
		for (int seriesIndex=0; seriesIndex<this.dataset.getSeriesCount(); seriesIndex++) {
			Comparable seriesKey = this.dataset.getSeriesKey(seriesIndex);
			
			if (seriesKey instanceof String) {					
				header.add((String) seriesKey);
			}
		}
		forExport.add((String[]) header.toArray(new String[header.size()]));

		// Keep track of the timepoints
		Set<Double> timepoints = new TreeSet<Double>();			
		
		/* Gather data */
		Map<Integer, Map<Double, Double>> data = new TreeMap<Integer, Map<Double, Double>>();
		
		for (int seriesIndex=0; seriesIndex<this.dataset.getSeriesCount(); seriesIndex++) {			
			Map<Double, Double> seriesMap = new TreeMap<Double, Double>();
			
			for (int i=0; i<this.dataset.getItemCount(seriesIndex); i++) {				
				Number x = this.dataset.getX(seriesIndex, i);
				Number y = this.dataset.getY(seriesIndex, i);
				
				seriesMap.put(x.doubleValue(), y.doubleValue());
				timepoints.add(x.doubleValue());
			}
			
			data.put(seriesIndex, seriesMap);
		}
			
		/* Convert data */
		for (Double timepoint : timepoints) {
			String[] values = new String[data.size()+1];
			
			/* Add information about timepoint */
			values[0] = timepoint.toString();
			
			/* Add information per timepoint */
			for(int seriesIndex=0; seriesIndex<data.size(); seriesIndex++) {
				Map<Double, Double> seriesData = data.get(seriesIndex);
				Double value = seriesData.get(timepoint);
				
				if (value != null) {
					values[seriesIndex+1] = value.toString(); // Index shift because of time column
				} else {
					values[seriesIndex+1] = ""; // Index shift because of time column
				}
			}
				
			forExport.add(values);
		}
		
		/* Write content to file */
		csvWriter.writeAll(forExport);
		csvWriter.close();
	} catch (IOException e) {
		logger.error("There was a problem with writing the file", e);
	}
}
 
開發者ID:modsim,項目名稱:vizardous,代碼行數:73,代碼來源:TraceChart2D.java


注:本文中的au.com.bytecode.opencsv.CSVWriter.NO_QUOTE_CHARACTER屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。