本文整理汇总了Java中au.com.bytecode.opencsv.CSVParser.DEFAULT_SEPARATOR属性的典型用法代码示例。如果您正苦于以下问题:Java CSVParser.DEFAULT_SEPARATOR属性的具体用法?Java CSVParser.DEFAULT_SEPARATOR怎么用?Java CSVParser.DEFAULT_SEPARATOR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类au.com.bytecode.opencsv.CSVParser
的用法示例。
在下文中一共展示了CSVParser.DEFAULT_SEPARATOR属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
}
示例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();
}
}
示例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);
}
}
示例5: 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);
}
示例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: 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;
}
示例8: 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());
}