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