Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) 2011 University of Tartu
  */
 package org.qsardb.conversion.csv;
 
 import java.io.*;
 import java.util.*;
 
import  org.apache.commons.csv.*;
public class CsvWorkbook extends Workbook {
	private List<CSVRecord> records = null;
	public CsvWorkbook(InputStream isthrows IOException {
		this(is, CSVFormat.DEFAULT);
	}
	public CsvWorkbook(InputStream is, CSVFormat formatthrows IOException {
		this. = readRecords(isformat);
	}
	public int getWorksheetCount(){
		return 1;
	}
	public CsvWorksheet getWorksheet(int sheet){
		if(sheet != 0){
		}
		return new CsvWorksheet(this.);
	}
	private List<CSVRecord> readRecords(InputStream is, CSVFormat formatthrows IOException {
		List<CSVRecord> result = new ArrayList<CSVRecord>();
		Reader reader = new InputStreamReader(is"UTF-8");
		try {
			CSVParser parser = new CSVParser(readerformat);
			Iterator<CSVRecord> records = parser.iterator();
			while(records.hasNext()){
				CSVRecord record = records.next();
				result.add(record);
			}
finally {
			reader.close();
		}
		return result;
	}
New to GrepCode? Check out our FAQ X