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


Java CSVReader.readAll方法代码示例

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


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

示例1: getPosts

import com.googlecode.jcsv.reader.CSVReader; //导入方法依赖的package包/类
@Override
   public List<PostCSV> getPosts() {

List<PostCSV> posts_list = null;
try {
    reader = new FileReader(filePath);

    CSVEntryParser<PostCSV> entryParser = new AnnotationEntryParser<PostCSV>(PostCSV.class, provider);
    CSVReader<PostCSV> csvPostReader = new CSVReaderBuilder<PostCSV>(reader).entryParser(entryParser).build();

    posts_list = csvPostReader.readAll();
} catch (IOException e) {
    System.out.println("Exception while reading" + e);
    e.printStackTrace();
}

return posts_list;
   }
 
开发者ID:learning-layers,项目名称:Expert-Identification-Service,代码行数:19,代码来源:ERSCSVParser.java

示例2: getUsers

import com.googlecode.jcsv.reader.CSVReader; //导入方法依赖的package包/类
@Override
   public List<UserCSV> getUsers() {
List<UserCSV> userList = null;
try {
    reader = new FileReader(filePath);
    
    CSVEntryParser<UserCSV> entryUserParser = new AnnotationEntryParser<UserCSV>(UserCSV.class, provider);
    CSVReader<UserCSV> csvUserReader = new CSVReaderBuilder<UserCSV>(reader)
	    .entryParser(entryUserParser).build();

    userList = csvUserReader.readAll();
} catch (IOException e) {
    e.printStackTrace();
}
return userList;
   }
 
开发者ID:learning-layers,项目名称:Expert-Identification-Service,代码行数:17,代码来源:ERSCSVParser.java

示例3: testeTempo

import com.googlecode.jcsv.reader.CSVReader; //导入方法依赖的package包/类
public static void testeTempo() throws IOException{
	int ano = 2014, mes = 05, dia = 21;
	String local = "LPFR";
	URL oracle = new URL("http://www.wunderground.com/history/airport/"+local+"/"+ano+"/"+mes+"/"+dia+"/DailyHistory.html?format=1");
	//http://www.wunderground.com/history/airport/KSAN/2012/10/1/MonthlyHistory.html?format=1
       BufferedReader reader = new BufferedReader(new InputStreamReader(oracle.openStream()));
	CSVReader<String[]> csvParser = CSVReaderBuilder.newDefaultReader(reader);
	List<String[]> data = csvParser.readAll();
	
	for(String[] strs : data){
		for(String str : strs){
			System.out.print(str+";");
		}
		System.out.println();
	}
}
 
开发者ID:zpankr,项目名称:SmartBetSystem,代码行数:17,代码来源:Util.java

示例4: read

import com.googlecode.jcsv.reader.CSVReader; //导入方法依赖的package包/类
public CoolRecord[] read() throws Exception {

		ArrayList<CoolRecord> records = new ArrayList<CoolRecord>();
		Reader reader = new FileReader(csvFileURI);
		CSVReader<String[]> csvReader = new CSVReaderBuilder<String[]>(reader)
				.entryParser(new DefaultCSVEntryParser())
				.strategy(CSVStrategy.UK_DEFAULT).build();

		boolean hasColumnRowSkipped = false;
		for (String[] csvReaderRecord : csvReader.readAll()) {

			if (!hasColumnRowSkipped) {
				hasColumnRowSkipped = true;
				continue;
			}

			CoolRecord record = null;

			// Column Detail is not provided by user. So, default is set to
			// String for all columns
			if (columns == null || columns.length < 0) {

				columns = new CoolColumn[csvReaderRecord.length];
				for (int i = 0; i < columns.length; i++) {
					columns[i] = new CoolColumn(null, i, String.class);
				}
			}
			record = new CoolRecord(columns, csvReaderRecord);

			records.add(record);
		}

		return records.toArray(new CoolRecord[records.size()]);
	}
 
开发者ID:realsoelynn,项目名称:CoolReader,代码行数:35,代码来源:CSVDataSource.java

示例5: readAllUsing

import com.googlecode.jcsv.reader.CSVReader; //导入方法依赖的package包/类
protected List<T> readAllUsing(CSVEntryParser<T> csvEntryParser, InputStream content) throws IOException {
    checkArgument(csvEntryParser != null, "Expected non-null csvEntryParser argument");
    checkArgument(content != null, "Expected non-null content argument");
    Reader reader = new InputStreamReader(content);
    CSVReader<T> csvReader = new CSVReaderBuilder<T>(reader)
            .strategy(csvStrategy)
            .entryParser(csvEntryParser)
            .build();
    return csvReader.readAll();
}
 
开发者ID:OtwartaPlatformaWyborcza,项目名称:OPW-backend-JavaEE,代码行数:11,代码来源:AbstractCSVReader.java

示例6: parseCsvFile

import com.googlecode.jcsv.reader.CSVReader; //导入方法依赖的package包/类
private List<TweetToSchedule> parseCsvFile(String pathToCsvFile) {
    List<TweetToSchedule> csvData = null;
    Reader reader = inputReader.getInputReader(pathToCsvFile);
    CSVReader<TweetToSchedule> csvParser = createCSVReader(reader);
    try {
        csvData = csvParser.readAll();
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    return csvData;
}
 
开发者ID:jstanier,项目名称:tweet-scheduler,代码行数:12,代码来源:InputParser.java

示例7: create

import com.googlecode.jcsv.reader.CSVReader; //导入方法依赖的package包/类
public static void create(){
try {
	//URI uri = DatabaseConnection.class.getResource("/db").toURI();
	//File folder = new File("db");
          InputStream listInputStream = DatabaseConnection.class.getResourceAsStream("/main/resources/tsi/db/list.txt");
          BufferedReader listReader = new BufferedReader(new InputStreamReader(listInputStream));

          Map<String,InputStream> inputStreamMap = new HashMap<>();
          String name;
          while ((name = listReader.readLine()) != null) {
              inputStreamMap.put(name, DatabaseConnection.class.getResourceAsStream("/main/resources/tsi/db/" + name));
          }

	anos = new String[inputStreamMap.size()];
          int idx = 0;
          for (Map.Entry<String, InputStream> entry : inputStreamMap.entrySet()){
              InputStream is = entry.getValue();
              String fName = entry.getKey();
              anos[idx] = fName.substring(0, 4);
              idx++;
              Reader reader = new InputStreamReader(is);
              CSVReader<String[]> csvParser = CSVReaderBuilder.newDefaultReader(reader);
              List<String[]> data = csvParser.readAll();
              db.add(data);
          }
	
	itemsToAdd = CSVReaderBuilder.newDefaultReader(new InputStreamReader(DatabaseConnection.class.getResourceAsStream("/main/resources/tsi/knap/items.csv"))).readAll();
	equipas = CSVReaderBuilder.newDefaultReader(new InputStreamReader(DatabaseConnection.class.getResourceAsStream("/main/resources/tsi/knap/equipas.csv"))).readAll();
	sites = CSVReaderBuilder.newDefaultReader(new InputStreamReader(DatabaseConnection.class.getResourceAsStream("/main/resources/tsi/knap/sites.csv"))).readAll();
	neuralScores = CSVReaderBuilder.newDefaultReader(new InputStreamReader(DatabaseConnection.class.getResourceAsStream("/main/resources/tsi/knap/neural.csv"))).readAll();
	resultados = CSVReaderBuilder.newDefaultReader(new InputStreamReader(DatabaseConnection.class.getResourceAsStream("/main/resources/tsi/knap/resultados.csv"))).readAll();
} catch (IOException e) {
	e.printStackTrace();
}
  }
 
开发者ID:zpankr,项目名称:SmartBetSystem,代码行数:36,代码来源:DatabaseConnection.java

示例8: read

import com.googlecode.jcsv.reader.CSVReader; //导入方法依赖的package包/类
public List<SeriesValue> read() throws IOException
{
    CSVReader<SeriesValue> reader = createReader();

    return reader.readAll();
}
 
开发者ID:andrey-vorobiev,项目名称:hudson-graph-plugin,代码行数:7,代码来源:SeriesValueStorage.java


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