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


Java CSVParser.DEFAULT_ESCAPE_CHARACTER属性代码示例

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


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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: TestFileIterator

public TestFileIterator(String relationName, Reader reader, char separator, char quotechar,
                    int skipLines,
                    boolean hasHeader) throws InputIterationException {
  this(relationName, reader, separator, quotechar, CSVParser.DEFAULT_ESCAPE_CHARACTER, skipLines,
       CSVParser.DEFAULT_STRICT_QUOTES, CSVParser.DEFAULT_IGNORE_LEADING_WHITESPACE, hasHeader);
}
 
开发者ID:HPI-Information-Systems,项目名称:metanome-algorithms,代码行数:6,代码来源:TestFileIterator.java

示例8: 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

示例9: 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

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