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


Java CSVParser.DEFAULT_QUOTE_CHARACTER属性代码示例

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


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

示例1: parseCSVFile

public List<InterpolatedDoublesCurve> parseCSVFile(URL fileUrl) {
  ArgumentChecker.notNull(fileUrl, "fileUrl");
  
  final List<InterpolatedDoublesCurve> curves = Lists.newArrayList();
  CSVDocumentReader csvDocumentReader = new CSVDocumentReader(fileUrl, CSVParser.DEFAULT_SEPARATOR, 
      CSVParser.DEFAULT_QUOTE_CHARACTER, CSVParser.DEFAULT_ESCAPE_CHARACTER, new FudgeContext());
  
  List<FudgeMsg> rowsWithError = Lists.newArrayList();
  for (FudgeMsg row : csvDocumentReader) {
    try {
      curves.add( createCurve(row));
    } catch (Exception ex) {
      ex.printStackTrace();
      rowsWithError.add(row);
    }
  }
  
  s_logger.warn("Total unprocessed rows: {}", rowsWithError.size());
  for (FudgeMsg fudgeMsg : rowsWithError) {
    s_logger.warn("{}", fudgeMsg);
  }
  return curves;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:23,代码来源:IRCurveParser.java

示例2: CSVInput

public CSVInput(InputStream ins) throws IOException {
    in = new CSVReader( new InputStreamReader(ins, StandardCharsets.UTF_8), CSVParser.DEFAULT_SEPARATOR, CSVParser.DEFAULT_QUOTE_CHARACTER, '\0' );
    
    String[] headerLine = in.readNext();
    if (headerLine == null) {
        throw new EpiException("No data, cannot read header line");
    }
    headers = new String[headerLine.length];
    for(int i = 0; i < headerLine.length; i++) {
        headers[i] = safeColName( headerLine[i].trim() );
    }
    lineNumber++;
    if (headerLine.length > 1 && headerLine[0].equals("#")) {
        hasPreamble = true;
    }
}
 
开发者ID:epimorphics,项目名称:dclib,代码行数:16,代码来源:CSVInput.java

示例3: getRecentFiles

public static Stream<Path> getRecentFiles() {
    try {
        String raw = PREFERENCES.get("recentFiles", "");
        /*
         * Use non-default constructor to set strictQuotes. This works
         * around a bug in the case that a single field is read with quotes
         * around it, eg "mypath". On decode the second quote is treated as
         * part of the string, so the result is the invalid `mypath"'
         */
        CSVParser parser = new CSVParser(
                CSVParser.DEFAULT_SEPARATOR,
                CSVParser.DEFAULT_QUOTE_CHARACTER,
                CSVParser.DEFAULT_ESCAPE_CHARACTER,
                true);

        return Stream.of(parser.parseLine(raw))
                .filter(string -> !string.isEmpty())
                .map(Paths::get)
                .filter(Files::exists);
    } catch (IOException ex) {
        LOG.log(Level.WARNING, null, ex);
        return Stream.empty();
    }
}
 
开发者ID:fuzzyBSc,项目名称:systemdesign,代码行数:24,代码来源:RecentFiles.java

示例4: loadExchangeData

/**
 * Loads the exchange data
 * 
 * @param filename  the filename, not null
 */
private void loadExchangeData() {
  InputStream is = getClass().getResourceAsStream(EXCHANGE_ISO_FILE);
  if (is == null) {
    throw new OpenGammaRuntimeException("Unable to locate " + EXCHANGE_ISO_FILE);
  }
  CSVReader exchangeIsoReader = new CSVReader(new InputStreamReader(is), CSVParser.DEFAULT_SEPARATOR, CSVParser.DEFAULT_QUOTE_CHARACTER, CSVParser.DEFAULT_ESCAPE_CHARACTER, 1);
  String [] nextLine;
  try {
    while ((nextLine = exchangeIsoReader.readNext()) != null) {
      String micCode = nextLine[0];
      String description = nextLine[1];
      String countryCode = nextLine[2];
      String country = nextLine[3];
      String city = nextLine[4];
      String acr = nextLine[5];
      String status = nextLine[7];
      if (StringUtils.isNotBlank(micCode) && StringUtils.isNotBlank(countryCode)) {
        Exchange exchange = new Exchange();
        exchange.setMic(micCode);
        exchange.setDescription(description);
        exchange.setCountryCode(countryCode);
        exchange.setCountry(country);
        exchange.setCity(city);
        exchange.setAcr(acr);
        exchange.setStatus(status);
        _exchangeMap.put(micCode, exchange);
        _exchangeDescriptionMap.put(description.toUpperCase(), exchange);
      }
    }
    exchangeIsoReader.close();
  } catch (IOException e) {
    throw new OpenGammaRuntimeException("Unable to read from " + EXCHANGE_ISO_FILE, e);
  }
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:39,代码来源:DefaultExchangeDataProvider.java

示例5: parse

public void parse(Reader fileReader, String fileType, LogRecordCollector collector) throws IOException {
  try (CSVReader csvReader = new CSVReader(
      fileReader,
      config.getDelimiter(),
      CSVParser.DEFAULT_QUOTE_CHARACTER,
      CSVParser.NULL_CHARACTER);) {

    long line = 0;

    String[] headers = csvReader.readNext();
    line++;
    String[] fieldNames = constructFieldNames(headers, fileType, config.isCleanKeysForES());

    String[] record = null;
    while ((record = csvReader.readNext()) != null) {
      if (record.length != headers.length) {
        // unmatched record length
        LOGGER.warn("Unmatched record column count detected at line {} - header: {} record: {}",
            line, headers.length, record.length);
        continue;
      }
      LogRecord logRecord = new LogRecord();
      for (int i = 0; i < fieldNames.length; i++) {
        if (config.isSkipBlankFields() && StringUtils.isBlank(record[i])) {
          // skip
        } else {
          String value = config.isTrimFieldValue() ? StringUtils.trim(record[i]) : record[i];
          logRecord.setValue(fieldNames[i], value);
        }
      }
      collector.emit(logRecord);
    }
  }
}
 
开发者ID:boozallen,项目名称:cognition,代码行数:34,代码来源:CsvLogRecordParser.java

示例6: CsvStreamReader

CsvStreamReader(Source source) {
  this(source,
    CSVParser.DEFAULT_SEPARATOR,
    CSVParser.DEFAULT_QUOTE_CHARACTER,
    CSVParser.DEFAULT_ESCAPE_CHARACTER,
    DEFAULT_SKIP_LINES,
    CSVParser.DEFAULT_STRICT_QUOTES,
    CSVParser.DEFAULT_IGNORE_LEADING_WHITESPACE);
}
 
开发者ID:apache,项目名称:calcite,代码行数:9,代码来源:CsvStreamReader.java

示例7: parseCsvCluster

private static void parseCsvCluster() throws IOException,
		FileNotFoundException, NoSuchAlgorithmException {
	say("parseCsvCluster() executes work..");
	CSVReader reader = new CSVReader(
			new FileReader(filenameGithubClusters), ',',
			CSVParser.DEFAULT_QUOTE_CHARACTER);
	String[] nextLine;
	nextLine = reader.readNext();
	
	List<Skill> headerSkills = new ArrayList<Skill>();
	for(int i = 0 ; i < 10 ; i++){
		Skill skill = skillFactory.getSkill(nextLine[i].replace("sc_",
				"").trim());
		headerSkills.add(skill);
	}

	while ((nextLine = reader.readNext()) != null) {
		Repository repo = new Repository(nextLine[11], nextLine[12]);
		HashMap<Skill, Double> hmp = parseCluster(nextLine[10]);
		for (int i = 0; i < 10; i++) {
			double howMuch = Double.parseDouble(nextLine[i]);
			if ( !(howMuch > 0.) )
				continue;
			if ( howMuch > TaskSkillFrequency.MAX)
				continue;
			hmp.put(headerSkills.get(i), howMuch);
		}
		skillSetMatrix.put(repo, hmp);
	}
	reader.close();
	
	skillSetArray = sortBySkillLength(skillSetMatrix);

	TaskSkillFrequency.tasksCheckSum = checksum(skillSetMatrix);
	
	iterator = 0;
}
 
开发者ID:wikiteams,项目名称:aon-emerging-wikiteams,代码行数:37,代码来源:TaskSkillsPool.java

示例8: create

@Override
public FixTable create(TestRun testRun) throws Exception {
    try (CSVReader reader = new CSVReader(getFileReader(testRun), separator, CSVParser.DEFAULT_QUOTE_CHARACTER, CSVParser.DEFAULT_ESCAPE_CHARACTER)) {
        List<String[]> myEntries = reader.readAll();
        String[] colNames = myEntries.get(0);
        List<String[]> rowData = myEntries.subList(1, myEntries.size());
        return StringArrayFixTableCreator.createFixTable(colNames, rowData);
    }
}
 
开发者ID:collectivemedia,项目名称:celos,代码行数:9,代码来源:FileFixTableCreator.java

示例9: getEntitiesByGeneSymbol

private Map<String, List<Entity>> getEntitiesByGeneSymbol()
{
	if (entitiesByGeneSymbol == null)
	{
		entitiesByGeneSymbol = new LinkedHashMap<>();

		try (CSVReader csvReader = new CSVReader(new InputStreamReader(new FileInputStream(file), UTF_8), '\t',
				CSVParser.DEFAULT_QUOTE_CHARACTER, 1))
		{
			String[] values = csvReader.readNext();
			while (values != null)
			{
				String geneSymbol = values[1];

				Entity entity = new DynamicEntity(getEntityType());
				entity.set(HPO_DISEASE_ID_COL_NAME, values[0]);
				entity.set(HPO_GENE_SYMBOL_COL_NAME, geneSymbol);
				entity.set(HPO_ID_COL_NAME, values[3]);
				entity.set(HPO_TERM_COL_NAME, values[4]);

				List<Entity> entities = entitiesByGeneSymbol.computeIfAbsent(geneSymbol, k -> new ArrayList<>());
				entities.add(entity);

				values = csvReader.readNext();
			}

		}
		catch (IOException e)
		{
			throw new UncheckedIOException(e);
		}

	}

	return entitiesByGeneSymbol;
}
 
开发者ID:molgenis,项目名称:molgenis,代码行数:36,代码来源:HPORepository.java

示例10: CSVSettings

public CSVSettings() {
    this.separator = CSVParser.DEFAULT_SEPARATOR;
    this.quote = CSVParser.DEFAULT_QUOTE_CHARACTER;
    this.escape = CSVParser.DEFAULT_ESCAPE_CHARACTER;
    this.skipLines = 0;
    this.strictQuotes = CSVParser.DEFAULT_STRICT_QUOTES;
    this.ignoreLeadingWhiteSpace = CSVParser.DEFAULT_IGNORE_LEADING_WHITESPACE;
    this.charset = Charsets.UTF_8;
}
 
开发者ID:edouardhue,项目名称:comeon,代码行数:9,代码来源:AddModel.java

示例11: parseCSVFile

public List<IRSwapSecurity> parseCSVFile(URL tradeFileUrl) {
  ArgumentChecker.notNull(tradeFileUrl, "tradeFileUrl");
          
  List<IRSwapSecurity> trades = Lists.newArrayList();
  CSVDocumentReader csvDocumentReader = new CSVDocumentReader(tradeFileUrl, CSVParser.DEFAULT_SEPARATOR, 
      CSVParser.DEFAULT_QUOTE_CHARACTER, CSVParser.DEFAULT_ESCAPE_CHARACTER, new FudgeContext());
  
  List<FudgeMsg> rowsWithError = Lists.newArrayList();
  List<FudgeMsg> unsupportedProdTypes = Lists.newArrayList();
  List<FudgeMsg> stubTrades = Lists.newArrayList();
  List<FudgeMsg> compoundTrades = Lists.newArrayList();
  List<FudgeMsg> missingPV = Lists.newArrayList();
  List<FudgeMsg> terminatedTrades = Lists.newArrayList();
  
  int count = 1;
  for (FudgeMsg row : csvDocumentReader) {
    count++;
    SwapSecurity swapSecurity = null;
    try {
      if (isUnsupportedProductType(row)) {
        unsupportedProdTypes.add(row);
        continue;
      }
      if (isStubTrade(row)) {
        stubTrades.add(row);
        continue;
      }
      if (isCompoundTrade(row)) {
        compoundTrades.add(row);
        continue;
      }
      if (isErsPVMissing(row)) {
        missingPV.add(row);
        continue;
      }
      if (isTeminatedTrade(row)) {
        terminatedTrades.add(row);
        continue;
      }
      swapSecurity = createSwapSecurity(row);
      trades.add(IRSwapSecurity.of(swapSecurity, row));
    } catch (Exception ex) {
      ex.printStackTrace();
      rowsWithError.add(row);
    }
  }
  
  logErrors("unsupportedProdTypes", unsupportedProdTypes, count);
  logErrors("stubTrades", stubTrades, count);
  logErrors("compoundTrades", compoundTrades, count);
  logErrors("missingPV", missingPV, count);
  logErrors("terminatedTrades", terminatedTrades, count);
      
  s_logger.warn("Total unprocessed rows: {} out of {}", rowsWithError.size(), count);
  for (FudgeMsg fudgeMsg : rowsWithError) {
    s_logger.warn("{}", fudgeMsg);
  }
  return trades;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:59,代码来源:IRSwapTradeParser.java

示例12: CSVInputReader

public CSVInputReader(Reader fileReader, char separator) {
    final boolean ignoreLeadingWhitespace = false;
    reader = new CSVReader(fileReader, separator, CSVParser.DEFAULT_QUOTE_CHARACTER,
            CSVParser.DEFAULT_ESCAPE_CHARACTER, CSVReader.DEFAULT_SKIP_LINES, CSVParser.DEFAULT_STRICT_QUOTES, ignoreLeadingWhitespace);
}
 
开发者ID:indeedeng,项目名称:imhotep-tsv-converter,代码行数:5,代码来源:CSVInputReader.java

示例13: CSVDocumentReader

/**
 * Constructs CSVDocumentReader using a comma for the separator.
 * 
 * @param docUrl the URL to the CSV source.
 */
public CSVDocumentReader(URL docUrl) {
  this(docUrl, CSVParser.DEFAULT_SEPARATOR, CSVParser.DEFAULT_QUOTE_CHARACTER, CSVParser.DEFAULT_ESCAPE_CHARACTER, OpenGammaFudgeContext.getInstance());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:8,代码来源:CSVDocumentReader.java


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