本文整理汇总了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;
}
示例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();
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}
示例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;
}
示例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);
}
示例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());
}